我正在尝试创建一个简单的java程序,它从zip文件中的文件中读取和提取内容.Zip文件包含3个文件(txt,pdf,docx).我需要阅读所有这些文件的内容,我正在使用Apache Tika.
有人可以帮我在这里实现功能.到目前为止我尝试过这个但没有成功
代码片段
public class SampleZipExtract {
public static void main(String[] args) {
List<String> tempString = new ArrayList<String>();
StringBuffer sbf = new StringBuffer();
File file = new File("C:\\Users\\xxx\\Desktop\\abc.zip");
InputStream input;
try {
input = new FileInputStream(file);
ZipInputStream zip = new ZipInputStream(input);
ZipEntry entry = zip.getNextEntry();
BodyContentHandler textHandler = new BodyContentHandler();
Metadata metadata = new Metadata();
Parser parser = new AutoDetectParser();
while (entry!= null){
if(entry.getName().endsWith(".txt") ||
entry.getName().endsWith(".pdf")||
entry.getName().endsWith(".docx")){
System.out.println("entry=" + entry.getName() + " " + entry.getSize());
parser.parse(input, textHandler, …Run Code Online (Sandbox Code Playgroud) 我有一个XHTML页面,其中有四个文本框
<h:column >
<f:facet name="header">
<h:outputText value="Start Date" />
</f:facet>
<h:inputText id="startDate" value="#{sampleVO.startDate}" />
</h:column>
<h:column >
<f:facet name="header">
<h:outputText value="End Date" />
</f:facet>
<h:inputText id="endDate" value="#{sampleVO.endDate}" />
</h:column>
<h:column >
<f:facet name="header">
<h:outputText value="Start Date" />
</f:facet>
<h:inputText id="startDate1" value="#{sampleVO.startDate}" />
</h:column>
<h:column >
<f:facet name="header">
<h:outputText value="End Date" />
</f:facet>
<h:inputText id="endDate1" value="#{sampleVO.endDate}" />
</h:column>
Run Code Online (Sandbox Code Playgroud)
我需要在开始日期和结束日期进行验证.如果用户在id ="startDate"&id ="endDate"中输入一些开始和结束日期,请说开始日期:"01/01/2012"(1jan)和结束日期:01/31/2012并且如果用户输入某些日期在id ="startDate1"和id ="endDate1"id ="startDate1"应始终大于id ="endDate",即日期范围不应重叠
public class SampleServiceimpl implements SampleService {
private List<SampleVO> listOfSample;
//this function gets called when clicked on …Run Code Online (Sandbox Code Playgroud) 在Python中,将数字的最后一位数字替换为零并保持前三位数字不变的最佳方法是什么?
例子:
23456789 -> 23400000
112022 -> 112000
1111-> 1110
111 -> 111 (no conversion)
Run Code Online (Sandbox Code Playgroud) 我有一个列表,其中包含格式(MON-YYYY)字符串格式的日期,我需要对此列表进行排序.我一直遵循的方法是读取列表并转换日期格式的字符串并使用比较选项,但我我没有得到理想的结果
代码片段
List<String> abc = new ArrayList<String>();
List<Date> xyz = new ArrayList<Date>();
abc.add("JAN-2010");
abc.add("JAN-2011");
abc.add("APR-2013");
abc.add("NOV-2009");
try {
for (String abc1 : abc) {
Date date;
date = new SimpleDateFormat("MMM-yyyy", Locale.ENGLISH)
.parse(abc1);
xyz.add(date);
}
Collections.sort(xyz, new Comparator<Date>() {
public int compare(Date arg0, Date arg1) {
// return arg0.getDate().compareTo(o2.getDate());
return arg0.compareTo(arg1);
}
});
for (Date date1 : xyz) {
System.out.println("Sorted : " + date1);
}
} catch (ParseException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
产量
Sorted : Sun Nov 01 00:00:00 IST …Run Code Online (Sandbox Code Playgroud) 我有以下 XML
<?xml version="1.0" encoding="UTF-8"?>
<stationary>
<textbook>
<name>test</name>
</textbook>
<notebook>
<books>
<name>test</name>
</books>
</notebook>
</stationary>
Run Code Online (Sandbox Code Playgroud)
我正在尝试获取所有name元素,而不管它们在stationary
我曾尝试使用以下语法,但没有奏效:
stationary/*/name/text()
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Rational Application Developer上配置WebSphere Application Server 8.5 beta.在WebSphere Application Server设置中,虽然已在WebSphere Application Server中创建了配置文件,但配置文件名称下拉列表仍为空.当我在WAS服务器设置上单击配置配置文件时,运行时中定义的WebSphere Application Server配置文件下的所有配置文件都将变为"只读".这意味着我没有权限管理服务器的配置文件,因为我是一个非root用户,具有对安装的只读访问权限.我正在使用具有管理权限的Windows 7(x64).
我正在关注此链接
但没有运气.
任何人都可以帮助我,如何更改服务器的访问级别?
我只是想了解更多有关BigDecimal的信息,但是下面的代码让我感到困惑.
Double x = 1.2;
String y = "1.2";
BigDecimal a = BigDecimal.ZERO;
BigDecimal b = BigDecimal.ZERO;
a = new BigDecimal(x);
b = new BigDecimal(y);
int res = res = b.compareTo(a);
if(res==1){
System.out.println("Die");
}else if(res ==0){
System.out.println("Live");
}else if (res==-1){
System.out.println("God Loves you");
}
Run Code Online (Sandbox Code Playgroud)
结果=死亡
我还没有准备好" 死 ",为什么BigDecimal一心想要杀了我.