ÓÃJava¶ÁÈ¡pdfÖеÄÊý¾Ý
ÓÃJava¼òµ¥µÄ¶ÁÈ¡pdfÎļþÖеÄÊý¾Ý£ºµÚÒ»²½£ºÏÂÔØPDFBox-0.7.2.jar¡£Ìṩһ¸öÏÂÔØµØÖ·£ºhttp://pdfhome.hope.com.cn/Resource.aspx?CID=63844604-5253-4ae1- b023-258c9e324061&RID=20cd8f94-1cee-40b6-a3df-0ef024f8e0d2½âѹºó£¬°ÑlibÎļþϵÄPDFBox-0.7.2.jar£¬PDFBox-0.7.2-log4j.jar·Åµ½Äãclasspath·¾¶Ï¡££¨ÎÒ°ÑÔ´ÂëÒÔ¼°jar°ü¶¼·Åµ½ÏÂÃæµÄ¸½¼þÀ·½ÃæÄãµÄʹÓᣣ©µÚ¶þ²½£ºÐ´¸ö¼òµ¥µÄ¶ÁÈ¡pdfÎļþµÄ³ÌÐò¡£(PdfReader.java)import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import org.pdfbox.pdmodel.PDDocument;
import org.pdfbox.util.PDFTextStripper;public class PdfReader {public void readFdf(String file) throws Exception {
// ÊÇ·ñÅÅÐò
boolean sort = false;
// pdfÎļþÃû
String pdfFile = file;
// ÊäÈëÎı¾ÎļþÃû³Æ
String textFile = null;
// ±àÂ뷽ʽ
String encoding = "UTF-8";
// ¿ªÊ¼ÌáȡҳÊý
int startPage = 1;
// ½áÊøÌáȡҳÊý
int endPage = Integer.MAX_VALUE;
// ÎļþÊäÈëÁ÷£¬Éú³ÉÎı¾Îļþ
Writer output = null;
// ÄÚ´æÖд洢µÄPDF Document
PDDocument document = null;
try {
try {
// Ê×Ïȵ±×÷Ò»¸öURLÀ´×°ÔØÎļþ£¬Èç¹ûµÃµ½Òì³£ÔÙ´Ó±¾µØÎļþϵͳ//È¥×°ÔØÎļþ
URL url = new URL(pdfFile); //×¢Òâ²ÎÊýÒѲ»ÊÇÒÔǰ°æ±¾ÖеÄURL.¶øÊÇFile¡£
document = PDDocument.load(pdfFile);
// »ñÈ¡PDFµÄÎļþÃû
String fileName = url.getFile();
// ÒÔÔÀ´PDFµÄÃû³ÆÀ´ÃüÃûвúÉúµÄtxtÎļþ
if (fileName.length() > 4) {
File outputFile = new File(fileName.substring(0, fileName
.length() - 4)
+ ".txt");
textFile = outputFile.getName();
}
} catch (MalformedURLException e) {
// Èç¹û×÷ΪURL×°ÔØµÃµ½Òì³£Ôò´ÓÎļþÏµÍ³×°ÔØ //×¢Òâ²ÎÊýÒѲ»ÊÇÒÔǰ°æ±¾ÖеÄURL.¶øÊÇFile¡£
document = PDDocument.load(pdfFile);
if (pdfFile.length() > 4) { textFile = pdfFile.substring(0, pdfFile.length() - 4)
+ ".txt";
}
}
// ÎļþÊäÈëÁ÷£¬Ð´ÈëÎļþµ¹textFile
output = new OutputStreamWriter(new FileOutputStream(textFile),
encoding);
// PDFTextStripperÀ´ÌáÈ¡Îı¾
PDFT
Ïà¹ØÎĵµ£º
public static void replaceString(String a,String b,String c){
System.out.println(a);
String result = a.replaceAll("(?i)"+b, c); //´óСд²»Ãô¸Ð
......
static String string2Unicode(String s) {
try {
StringBuffer out = new StringBuffer("");
byte[] bytes = s.getBytes("unicode");
for (int i = 2; i < bytes.length - 1; i += 2) {
out.append("u");
String str = Integer.toHexString(bytes[i + 1] & 0xff);
f ......
package com.mywebtest.common;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/**
* Java reflection ·Ç³£ÓÐÓã¬ËüʹÀàºÍÊý¾Ý½á¹¹Äܰ´Ãû³Æ¶¯Ì¬¼ìË÷Ïà¹ØÐÅÏ¢£¬²¢ÔÊÐíÔÚÔËÐÐ× ......
JAVAÅÅÐòËã·¨£¨·ÇÔ´´£©
package Sort;
class Data {
Comparable key;
Object value;
public Data() {
}
public Data(Data data){
this.key=data.key;
this.value=data.value;
  ......
JavaÖеÄÎÒÃÇ¿ÉÒÔÀûÓÃsplit°Ñ×Ö·û´®°´ÕÕÖ¸¶¨µÄ·Ö¸î·û½øÐзָȻºó·µ»Ø×Ö·û´®Êý×飬ÏÂÃæÊÇstring.splitµÄÓ÷¨ÊµÀý¼°×¢ÒâÊÂÏ
java.lang.string.split
split ·½·¨
½«Ò»¸ö×Ö·û´®·Ö¸îΪ×Ó×Ö·û´®£¬È»ºó½«½á¹û×÷Ϊ×Ö·û´®Êý×é·µ»Ø¡£
stringObj.split([separator£¬[limit]]) Ãâ·Ñ×ÊÔ´ÊÕ¼¯Íø£¨http://www.freezq.cn£©
strin ......