??xml version="1.0" encoding="utf-8" standalone="yes"?>国产高清在线不卡,亚洲男人天堂手机在线,97精品在线视频 http://www.aygfsteel.com/anchor110/category/45626.htmlzh-cn Fri, 20 Apr 2018 16:02:40 GMT Fri, 20 Apr 2018 16:02:40 GMT 60 org.apache.axiom.om.OMException: No meta factory found for feature 'default';错误解决办法 http://www.aygfsteel.com/anchor110/articles/433158.html一败涂?/dc:creator>一败涂?/author>Tue, 17 Apr 2018 12:14:00 GMT http://www.aygfsteel.com/anchor110/articles/433158.html http://www.aygfsteel.com/anchor110/comments/433158.html http://www.aygfsteel.com/anchor110/articles/433158.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/433158.html http://www.aygfsteel.com/anchor110/services/trackbacks/433158.html Exception in thread "main" org.apache.axiom.om.OMException: No meta factory found for feature 'default'; this usually means that axiom-impl.jar is not in the classpath at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:170) at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:135) at org.apache.axiom.om.OMAbstractFactory.getOMFactory(OMAbstractFactory.java:184) at org.apache.axis2.description.AxisDescription.<init>(AxisDescription.java:72) at org.apache.axis2.description.AxisService.<init>(AxisService.java:323) at org.apache.axis2.description.AxisService.<init>(AxisService.java:394) at com.ailk.boss.external.ws.External2Oss_PortTypeServiceStub.populateAxisService(External2Oss_PortTypeServiceStub.java:41) at com.ailk.boss.external.ws.External2Oss_PortTypeServiceStub.<init>(External2Oss_PortTypeServiceStub.java:88) at com.ailk.boss.external.ws.External2Oss_PortTypeServiceStub.<init>(External2Oss_PortTypeServiceStub.java:77) at com.ailk.boss.external.ws.External2Oss_PortTypeServiceStub.<init>(External2Oss_PortTypeServiceStub.java:123) at WooEquipmentSend.send2Esb(WooEquipmentSend.java:20) at WooPPPoEServiceTest.testGetPPPoEAndSettings(WooPPPoEServiceTest.java:32) at WooPPPoEServiceTest.main(WooPPPoEServiceTest.java:18) 解决办法Q?br />1、将pȝ依赖的以下三个jar包版本从1.2.13替换?.2.12卛_Q?br />axiom-api-1.2.12.jar
axiom-dom-1.2.12.jar
axiom-impl-1.2.12.jar
]]> Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object http://www.aygfsteel.com/anchor110/articles/395110.html一败涂?/dc:creator>一败涂?/author>Mon, 04 Feb 2013 07:38:00 GMT http://www.aygfsteel.com/anchor110/articles/395110.html http://www.aygfsteel.com/anchor110/comments/395110.html http://www.aygfsteel.com/anchor110/articles/395110.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/395110.html http://www.aygfsteel.com/anchor110/services/trackbacks/395110.html Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
问题原因是:(x)jre/lib目录下,~少rt.jar文g?br /> 解决办法Q去别的服务器上拯rt.jar卛_?img src ="http://www.aygfsteel.com/anchor110/aggbug/395110.html" width = "1" height = "1" /> ]]> Caused by: java.lang.NoClassDefFoundError: com/sun/xml/bind/CycleRecoverable http://www.aygfsteel.com/anchor110/articles/391408.html一败涂?/dc:creator>一败涂?/author>Thu, 15 Nov 2012 20:53:00 GMT http://www.aygfsteel.com/anchor110/articles/391408.html http://www.aygfsteel.com/anchor110/comments/391408.html http://www.aygfsteel.com/anchor110/articles/391408.html#Feedback 1 http://www.aygfsteel.com/anchor110/comments/commentRss/391408.html http://www.aygfsteel.com/anchor110/services/trackbacks/391408.html 1、将jaxb-impl-2.1.12.jar和jaxb-api-2.1.jar攑ֈjre/lib/endorsed/目录下,如果没有endorsed目录Q则新徏之,一般情况下是没有的?br />2、将jaxb-impl-2.1.12.jar和jaxb-api-2.1.jar攑ֈ$TOMCAT_HOME/lib/endorsed/目录下,如果没有endorsed目录Q则新徏之,一般情况下是没有的?img src ="http://www.aygfsteel.com/anchor110/aggbug/391408.html" width = "1" height = "1" /> ]]> CountDownLatch的用(注:(x)转蝲于http://www.aygfsteel.com/fanjs2000/archive/2012/10/31/390521.htmlQ?/title> http://www.aygfsteel.com/anchor110/articles/390549.html一败涂?/dc:creator>一败涂?/author>Wed, 31 Oct 2012 09:19:00 GMT http://www.aygfsteel.com/anchor110/articles/390549.html http://www.aygfsteel.com/anchor110/comments/390549.html http://www.aygfsteel.com/anchor110/articles/390549.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/390549.html http://www.aygfsteel.com/anchor110/services/trackbacks/390549.html CountDownLatch如其所写,是一个倒计数的锁存器,当计数减?时触发特定的事g。利用这U特性,可以让主U程{待子线E的l束。下面以一个模拟运动员比赛的例子加以说明?/div>import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Test { private static final int PLAYER_AMOUNT = 5 ; public static void main(String[] args) { // 对于每位q动员,CountDownLatch?后即l束比赛 CountDownLatch begin = new CountDownLatch( 1 ); // 对于整个比赛Q所有运动员l束后才结?/span> CountDownLatch end = new CountDownLatch(PLAYER_AMOUNT); Player[] plays = new Player[PLAYER_AMOUNT]; for ( int i = 0 ; i < PLAYER_AMOUNT; i ++ ) plays[i] = new Player(i + 1 , begin, end); // 讄特定的线E池Q大ؓ(f)5 ExecutorService exe = Executors.newFixedThreadPool(PLAYER_AMOUNT); for (Player p : plays) exe.execute(p); // 分配U程 begin.countDown(); System.out.println( " Race begins! " ); try { end.await(); // {待end状态变?Q即为比赛结?/span> } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } finally { System.out.println( " Race ends! " ); } exe.shutdown(); } } class Player implements Runnable { private int id; private CountDownLatch begin; private CountDownLatch end; public Player( int i, CountDownLatch begin, CountDownLatch end) { // TODO Auto-generated constructor stub super (); this .id = i; this .begin = begin; this .end = end; } public void run() { // TODO Auto-generated method stub try { begin.await(); // {待begin的状态ؓ(f)0 Thread.sleep(( long ) (Math.random() * 100 )); // 随机分配旉Q即q动员完成时?/span> System.out.println( " Play " + id + " arrived. " ); } catch (InterruptedException e) { // TODO: handle exception e.printStackTrace(); } finally { end.countDown(); // 使end状态减1Q最l减? } } }
]]> synchronized(this) 解释 http://www.aygfsteel.com/anchor110/articles/388699.html一败涂?/dc:creator>一败涂?/author>Thu, 27 Sep 2012 08:03:00 GMT http://www.aygfsteel.com/anchor110/articles/388699.html http://www.aygfsteel.com/anchor110/comments/388699.html http://www.aygfsteel.com/anchor110/articles/388699.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/388699.html http://www.aygfsteel.com/anchor110/services/trackbacks/388699.html public class DemoThread implements Runnable { public void run() { synchronized ( this ) { // 请问q里的this怎样理解Qt1和t2的地址不是不一样嘛Q怎么?x)只有一个线E运行?Q? for ( int i = 0 ; i < 5 ; i ++ ) { System.out.println(Thread.currentThread().getName() + " synchronized loop " + i); } } } public static void main(String[] args) { DemoThread t1 = new DemoThread(); Thread ta = new Thread(t1, " A " ); Thread tb = new Thread(t1, " B " ); ta.start(); tb.start(); } } 解释Q?br /> q里的this是指当前对象,也就是说不管taq是tb,刚开始运行这D代码的时候会(x)l这D代码加个锁,q样即ɘq行C间被替换? 另一个线E也不会(x)执行q段代码,因ؓ(f)q段代码加锁?而钥匙在l代码加锁的那个U程手里,只有加锁的线E运行完q段代码,才会(x)l代码解? 然后其他U程才能执行q段代码.. 加个synchronized(this)以后q行l果是这? A synchronized loop 0 A synchronized loop 1 A synchronized loop 2 A synchronized loop 3 A synchronized loop 4 B synchronized loop 0 B synchronized loop 1 B synchronized loop 2 B synchronized loop 3 B synchronized loop 4 不加的话是这?(序׃,有好多种l果,q里只是其中一U?.. A synchronized loop 0 B synchronized loop 0 A synchronized loop 1 B synchronized loop 1 A synchronized loop 2 B synchronized loop 2 A synchronized loop 3 B synchronized loop 3 B synchronized loop 4 A synchronized loop 4 ]]> javaU程q行机制 http://www.aygfsteel.com/anchor110/articles/379874.html一败涂?/dc:creator>一败涂?/author>Sun, 03 Jun 2012 14:09:00 GMT http://www.aygfsteel.com/anchor110/articles/379874.html http://www.aygfsteel.com/anchor110/comments/379874.html http://www.aygfsteel.com/anchor110/articles/379874.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/379874.html http://www.aygfsteel.com/anchor110/services/trackbacks/379874.html 阅读全文 ]]> Arrays.asList使用 http://www.aygfsteel.com/anchor110/articles/362588.html一败涂?/dc:creator>一败涂?/author>Thu, 03 Nov 2011 02:18:00 GMT http://www.aygfsteel.com/anchor110/articles/362588.html http://www.aygfsteel.com/anchor110/comments/362588.html http://www.aygfsteel.com/anchor110/articles/362588.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/362588.html http://www.aygfsteel.com/anchor110/services/trackbacks/362588.html 1 String[] strings = { " xujiaolin " , " chengsk " , " caisiming " }; 2 List < String > list = Arrays.asList(strings); 3 System.out.println(list.size()); ]]> java final关键解释 http://www.aygfsteel.com/anchor110/articles/362585.html一败涂?/dc:creator>一败涂?/author>Thu, 03 Nov 2011 02:02:00 GMT http://www.aygfsteel.com/anchor110/articles/362585.html http://www.aygfsteel.com/anchor110/comments/362585.html http://www.aygfsteel.com/anchor110/articles/362585.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/362585.html http://www.aygfsteel.com/anchor110/services/trackbacks/362585.html 解释如下Q?br />1、如果此对象指向一个常量:(x) 例如Qfinal int a = 100;那么a的值永q是100?br /> 后箋如果重新赋|会(x)报编译错误:(x)a = 200; 2、如果此对象指向一个变量:(x) 例如Qfinal User admin = new User("administrator");那么代表adminq个对象引用不可改变。但是却可以改变他的属性倹{?br /> 以下语句~译正确Q?br /> admin.setName("admin"); 以下语句~译错误Q?br /> admin = new User("zhangsan"); ]]> HttpUrlConnection通过代理讉K|络Q{Qhttp://www.iteye.com/problems/38978Q?/title> http://www.aygfsteel.com/anchor110/articles/360413.html一败涂?/dc:creator>一败涂?/author>Mon, 10 Oct 2011 09:52:00 GMT http://www.aygfsteel.com/anchor110/articles/360413.html http://www.aygfsteel.com/anchor110/comments/360413.html http://www.aygfsteel.com/anchor110/articles/360413.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/360413.html http://www.aygfsteel.com/anchor110/services/trackbacks/360413.html import java.io.IOException; import java.io.InputStream; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.util.List; import java.util.Properties; public class NetProxy { // 试本地JVM的网l缺省配|?nbsp; public void setLocalProxy() { Properties prop = System.getProperties(); //讄http讉K要用的代理服务器的地址 prop.setProperty("http.proxyHost", "10.10.0.96"); //讄http讉K要用的代理服务器的端口 prop.setProperty("http.proxyPort", "8080"); //讄不需要通过代理服务器访问的LQ可以?通配W,多个地址用|分隔 prop.setProperty("http.nonProxyHosts", "localhost|10.10.*"); //讄安全讉K使用的代理服务器地址与端?nbsp; //它没有https.nonProxyHosts属性,它按照http.nonProxyHosts 中设|的规则讉K prop.setProperty("https.proxyHost", "10.10.0.96"); prop.setProperty("https.proxyPort", "443"); //使用ftp代理服务器的L、端口以?qing)不需要用ftp代理服务器的L prop.setProperty("ftp.proxyHost", "10.10.0.96"); prop.setProperty("ftp.proxyPort", "2121"); prop.setProperty("ftp.nonProxyHosts", "localhost|10.10.*"); //socks代理服务器的地址与端?nbsp; prop.setProperty("socksProxyHost", "10.10.0.96"); prop.setProperty("socksProxyPort", "1080"); } // 清除proxy讄 public void removeLocalProxy() { Properties prop = System.getProperties(); prop.remove("http.proxyHost"); prop.remove("http.proxyPort"); prop.remove("http.nonProxyHosts"); prop.remove("https.proxyHost"); prop.remove("https.proxyPort"); prop.remove("ftp.proxyHost"); prop.remove("ftp.proxyPort"); prop.remove("ftp.nonProxyHosts"); prop.remove("socksProxyHost"); prop.remove("socksProxyPort"); } // // 试http public void showHttpProxy(Object... proxy) { URL url = null; try { url = new URL("http://blog.csdn.com/smallnest"); } catch (MalformedURLException e) { return; } try { URLConnection conn = null; switch (proxy.length) { case 0: conn = url.openConnection(); break; case 1: conn = url.openConnection((Proxy) proxy[0]); break; default: break; } if (conn == null) return; conn.setConnectTimeout(3000); // 讄q接时旉 InputStream in = conn.getInputStream(); byte[] b = new byte[1024]; try { while (in.read(b) > 0) { System.out.println(new String(b)); } } catch (IOException e1) { } } catch (IOException e1) { e1.printStackTrace(); } } // 试ftp public void showFtpProxy(Object... proxy) { URL url = null; try { url = new URL("ftp://ftp.tsinghua.edu.cn"); } catch (MalformedURLException e) { return; } try { URLConnection conn = null; switch (proxy.length) { case 0: conn = url.openConnection(); break; case 1: conn = url.openConnection((Proxy) proxy[0]); break; default: break; } if (conn == null) return; conn.setConnectTimeout(3000); // 讄q接时旉 InputStream in = conn.getInputStream(); byte[] b = new byte[1024]; try { while (in.read(b) > 0) { System.out.println(new String(b)); } } catch (IOException e1) { } } catch (IOException e1) { e1.printStackTrace(); } } // 得到一个proxy public Proxy getProxy(Proxy.Type type, String host, int port) { SocketAddress addr = new InetSocketAddress(host,port); Proxy typeProxy = new Proxy(type, addr); return typeProxy; } public static void main(String[] args) { NetProxy proxy = new NetProxy(); //试代理服务?nbsp; proxy.setLocalProxy(); proxy.showHttpProxy(); //下面两行是清除系l属性,而通过ProxycL定代理服务器 // proxy.removeLocalProxy //proxy.showHttpProxy(proxy.getProxy(Proxy.Type.SOCKS,"10.10.0.96",1080)); } } ]]> java.net.ProtocolException http://www.aygfsteel.com/anchor110/articles/355875.html一败涂?/dc:creator>一败涂?/author>Fri, 05 Aug 2011 07:53:00 GMT http://www.aygfsteel.com/anchor110/articles/355875.html http://www.aygfsteel.com/anchor110/comments/355875.html http://www.aygfsteel.com/anchor110/articles/355875.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/355875.html http://www.aygfsteel.com/anchor110/services/trackbacks/355875.html 做androidd功能Ӟ向服务器发送一个登录验证请求,利用的通信是自己包装的http通信c,里面有代码如下:(x)URL url = new URL(reqAddress); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5000); conn.setReadTimeout(6000);
conn.setRequestMethod("post"); 一q行Qlogcat报错如下Q?br />
java.net.ProtocolException
解决办法Q?br />修改
post 为大写POST?br />
说明Q?br />
httpURLConnection.setRequestMethod("POST");
setRequestMethodҎ(gu)的参数值必d?例如GET,POST{?
]]> tomcat日志U色问题解决办法 http://www.aygfsteel.com/anchor110/articles/355732.html一败涂?/dc:creator>一败涂?/author>Thu, 04 Aug 2011 02:43:00 GMT http://www.aygfsteel.com/anchor110/articles/355732.html http://www.aygfsteel.com/anchor110/comments/355732.html http://www.aygfsteel.com/anchor110/articles/355732.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/355732.html http://www.aygfsteel.com/anchor110/services/trackbacks/355732.html 在eclipse中启动tomcatӞ在console中输出的日志信息为红Ԍ但其实程序ƈ没有错误?br /> 原因是:(x)tomcat默认的日志输出按jdk中的System.err来输出,而System.err在eclipse中,以红色显C?br /> 解决办法Q?br />Eclipse ?System.err 的显C颜色可以通过 Window --> Preference --> Run/Debug --> Console ?Standard Error text color q行更改?br /> JDK 日志具体的输出处理类需要在 %JRE_HOME%/lib/logging.properties 配置?handlers 指定Q可以? System.out 重写一?java.util.logging.ConsoleHandler 配置q去可以了?/div> ]]> Java获得一个字W的Ascii?/title> http://www.aygfsteel.com/anchor110/articles/353702.html一败涂?/dc:creator>一败涂?/author>Tue, 05 Jul 2011 05:04:00 GMT http://www.aygfsteel.com/anchor110/articles/353702.html http://www.aygfsteel.com/anchor110/comments/353702.html http://www.aygfsteel.com/anchor110/articles/353702.html#Feedback 1 http://www.aygfsteel.com/anchor110/comments/commentRss/353702.html http://www.aygfsteel.com/anchor110/services/trackbacks/353702.html int aAscii = a; System.out.println(aAscii); ]]> java.net.SocketException: Unexpected end of file from server http://www.aygfsteel.com/anchor110/articles/348867.html一败涂?/dc:creator>一败涂?/author>Sat, 23 Apr 2011 07:28:00 GMT http://www.aygfsteel.com/anchor110/articles/348867.html http://www.aygfsteel.com/anchor110/comments/348867.html http://www.aygfsteel.com/anchor110/articles/348867.html#Feedback 8 http://www.aygfsteel.com/anchor110/comments/commentRss/348867.html http://www.aygfsteel.com/anchor110/services/trackbacks/348867.html
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:741)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:738)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:604)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:961)
莫名奇妙Q明明头天在公司是可以用的?br />
在网上搜索了一下,说可能是|络限制造成的。我l合自己所在网l的情况Q发觉是有这情况。把|络Ҏ(gu)跟外面一L(fng)后,问题解决?br />
]]> 使用java实现|络传输数据的压~(来源|络Q?/title> http://www.aygfsteel.com/anchor110/articles/348441.html一败涂?/dc:creator>一败涂?/author>Sun, 17 Apr 2011 07:59:00 GMT http://www.aygfsteel.com/anchor110/articles/348441.html http://www.aygfsteel.com/anchor110/comments/348441.html http://www.aygfsteel.com/anchor110/articles/348441.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/348441.html http://www.aygfsteel.com/anchor110/services/trackbacks/348441.html
import java.util.zip.*;
public class GZIProc {
public static void main(String[] args) {
byte[] b1 ,b2 = null;
try {
BufferedInputStream in = new BufferedInputStream( new FileInputStream(args[0]));
ByteArrayOutputStream bout = new ByteArrayOutputStream();
GZIPOutputStream out = new GZIPOutputStream(bout);
ObjectOutputStream oout = new ObjectOutputStream(out);
// d源文?
b1 = new byte[in.available()];
in.read(b1,0,b1.length);
System.out.println( "压羃?\n " + new String(b1));
// 压羃
//out.write(b1,0, b1.length);
oout.writeObject(new String(b1));
oout.flush();
oout.close();
// d压羃字节?
b2 = bout.toByteArray();
System.out.println( "压羃?\n " + new String(b2));
// 关闭数据?
in.close();
// 解压
ObjectInputStream in2 = new
ObjectInputStream(new GZIPInputStream(new
ByteArrayInputStream(b2)));
byte[] b3 = ((String)in2.readObject()).getBytes();
in2.close();
// 输出
System.out.println( new String(b3));
} catch(Exception e) {
e.printStackTrace();
}
}
}
]]> javaInputStream转ؓ(f)byte数组的方?/title> http://www.aygfsteel.com/anchor110/articles/343500.html一败涂?/dc:creator>一败涂?/author>Tue, 25 Jan 2011 06:44:00 GMT http://www.aygfsteel.com/anchor110/articles/343500.html http://www.aygfsteel.com/anchor110/comments/343500.html http://www.aygfsteel.com/anchor110/articles/343500.html#Feedback 3 http://www.aygfsteel.com/anchor110/comments/commentRss/343500.html http://www.aygfsteel.com/anchor110/services/trackbacks/343500.html ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = 0 ;
byte [] b = new byte [ 1024 ];
while ((len = is.read(b, 0 , b.length)) != - 1 ) {
baos.write(b, 0 , len);
}
byte [] buffer = baos.toByteArray();
]]> java.net.URL处理中文URLQ导致java.io.FileNotFoundException http://www.aygfsteel.com/anchor110/articles/342456.html一败涂?/dc:creator>一败涂?/author>Thu, 06 Jan 2011 13:57:00 GMT http://www.aygfsteel.com/anchor110/articles/342456.html http://www.aygfsteel.com/anchor110/comments/342456.html http://www.aygfsteel.com/anchor110/articles/342456.html#Feedback 1 http://www.aygfsteel.com/anchor110/comments/commentRss/342456.html http://www.aygfsteel.com/anchor110/services/trackbacks/342456.html
URL url = new URL("http://***/中国.doc");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
执行以上代码Ӟ?x)报java.io.FileNotFoundException异常?br />
l查Q发现是url地址含中文问题导致的?br />
解决办法Q?br />
对中文部分进行encode,具体如下Q?br />
URL url = new URL("http://***/" + java.net.URLEncoder.encode("中国") + ".doc");
]]> JAVA解析XML字符?/title> http://www.aygfsteel.com/anchor110/articles/342312.html一败涂?/dc:creator>一败涂?/author>Tue, 04 Jan 2011 13:57:00 GMT http://www.aygfsteel.com/anchor110/articles/342312.html http://www.aygfsteel.com/anchor110/comments/342312.html http://www.aygfsteel.com/anchor110/articles/342312.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/342312.html http://www.aygfsteel.com/anchor110/services/trackbacks/342312.html 1 DocumentBuilderFactory docBuilderFactory = null ;
2 DocumentBuilder docBuilder = null ;
3 Document doc = null ;
4 docBuilderFactory = DocumentBuilderFactory.newInstance();
5 docBuilder = docBuilderFactory.newDocumentBuilder();
6 InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); // xml解析的字W串
7 doc = docBuilder.parse(inputStream);
]]> 16q制字符串{换成数字cd http://www.aygfsteel.com/anchor110/articles/342168.html一败涂?/dc:creator>一败涂?/author>Sun, 02 Jan 2011 11:57:00 GMT http://www.aygfsteel.com/anchor110/articles/342168.html http://www.aygfsteel.com/anchor110/comments/342168.html http://www.aygfsteel.com/anchor110/articles/342168.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/342168.html http://www.aygfsteel.com/anchor110/services/trackbacks/342168.html public class Test {
public static void main(String[] args) {
String s = " 0x40 " ;
int b = Integer.parseInt(s.replaceAll( " ^0[x|X] " , "" ), 16 );
System.out.println(( char )b);
}
}
]]> java中用MD5加密法q行加密(注:(x)转蝲于http://school.cfan.com.cn/pro/java/2007-06-11/1181531460d67777.shtml) http://www.aygfsteel.com/anchor110/articles/341737.html一败涂?/dc:creator>一败涂?/author>Tue, 28 Dec 2010 03:10:00 GMT http://www.aygfsteel.com/anchor110/articles/341737.html http://www.aygfsteel.com/anchor110/comments/341737.html http://www.aygfsteel.com/anchor110/articles/341737.html#Feedback 0 http://www.aygfsteel.com/anchor110/comments/commentRss/341737.html http://www.aygfsteel.com/anchor110/services/trackbacks/341737.html Q一Q消息摘要简?/strong>
一个消息摘要就是一个数据块的数字指UV即对一个Q意长度的一个数据块q行计算Q生一个唯一指印Q对于SHA1是生一?0字节的二q制数组Q。消?
摘要是一U与消息认证码结合用以保消息完整性的技术。主要用单向散列函数算法,可用于检验消息的完整性,和通过散列密码直接以文本Ş式保存等Q目?
q泛使用的算法有MD4、MD5、SHA-1.
消息摘要有两个基本属性:(x)
两个不同的报文难以生成相同的摘要难以Ҏ(gu)定的摘要生成一个报文,而可以由该报文反推算指定的摘要代表:(x)国国家标准技术研I所的SHA1和麻省理工学院Ronald Rivest提出的MD5
Q二Q对字符串进行加?/strong>
/** *//**利用MD5q行加密
* @param str 待加密的字符?br />
* @return 加密后的字符?br />
* @throws NoSuchAlgorithmException 没有q种产生消息摘要的算?br />
* @throws UnsupportedEncodingException
*/
public String EncoderByMd5(String str) throws NoSuchAlgorithmException,
UnsupportedEncodingException...{
//定计算Ҏ(gu)
MessageDigest md5=MessageDigest.getInstance("MD5");
BASE64Encoder base64en = new BASE64Encoder();
//加密后的字符?br />
String newstr=base64en.encode(md5.digest(str.getBytes("utf-8")));
return newstr;
}
调用函数QString str="0123456789"
System.out.printlnQEncoderByMd5QstrQ)Q?/p>
输出QeB5eJF1ptWaXm4bijSPyxw==
Q三Q验证密码是否正?/strong>
因ؓ(f)MD5是基于消息摘要原理的Q消息摘要的基本特征是很难Ҏ(gu)摘要推算出消息报文,因此要验证密码是否正,必d输入密码Q消息报文)重新计算?
摘要Q和数据库中存储的摘要进行对比(x据库中存储的其实为用户密码的摘要Q,若两个摘要相同,则说明密码正,不同Q则说明密码错误?br />
/** *//**判断用户密码是否正确
* @param newpasswd 用户输入的密?br />
* @param oldpasswd 数据库中存储的密码-Q用户密码的摘要
* @return
* @throws NoSuchAlgorithmException
* @throws UnsupportedEncodingException
*/
public boolean checkpassword(String newpasswd,String oldpasswd) throws NoSuchAlgorithmException,
UnsupportedEncodingException...{
if(EncoderByMd5(newpasswd).equals(oldpasswd))
return true;
else
return false;
}
]]>java 获取文g夹大,文g大小Q文件个?注:(x)转蝲于http://blog.sina.com.cn/s/blog_45096c6a0100btse.html) http://www.aygfsteel.com/anchor110/articles/341284.html一败涂?/dc:creator>一败涂?/author>Tue, 21 Dec 2010 16:18:00 GMT http://www.aygfsteel.com/anchor110/articles/341284.html http://www.aygfsteel.com/anchor110/comments/341284.html http://www.aygfsteel.com/anchor110/articles/341284.html#Feedback 2 http://www.aygfsteel.com/anchor110/comments/commentRss/341284.html http://www.aygfsteel.com/anchor110/services/trackbacks/341284.html package tony;
import java.io.File;
import java.text.DecimalFormat;
import java.io.FileInputStream;
public class GetFileSize
{
public long
getFileSizes(File f) throws Exception{//取得文g大小
long s=0;
if (f.exists()) {
FileInputStream fis = null;
fis = new FileInputStream(f);
s= fis.available();
} else {
f.createNewFile();
System.out.println("文g不存?);
}
return s;
}
// 递归
public long
getFileSize(File f)throws Exception//取得文g夹大?br />
{
long size = 0;
File flist[] = f.listFiles();
for (int i = 0; i < flist.length; i++)
{
if (flist[i].isDirectory())
{
size = size + getFileSize(flist[i]);
} else
{
size = size + flist[i].length();
}
}
return size;
}
public
String FormetFileSize(long fileS) {//转换文g大小
DecimalFormat df = new DecimalFormat("#.00");
String fileSizeString = "";
if (fileS < 1024) {
fileSizeString = df.format((double) fileS) + "B";
} else if (fileS < 1048576) {
fileSizeString = df.format((double) fileS / 1024) + "K";
} else if (fileS < 1073741824) {
fileSizeString = df.format((double) fileS / 1048576) + "M";
} else {
fileSizeString = df.format((double) fileS / 1073741824) +
"G";
}
return fileSizeString;
}
public long
getlist(File f){//递归求取目录文g个数
long size = 0;
File flist[] = f.listFiles();
size=flist.length;
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getlist(flist[i]);
size--;
}
}
return size;
}
public
static void main(String args[])
{
GetFileSize g = new GetFileSize();
long startTime = System.currentTimeMillis();
try
{
long l = 0;
String path = "C:\\WINDOWS";
File ff = new File(path);
if (ff.isDirectory()) { //如果路径是文件夹的时?br />
System.out.println("文g个数
" + g.getlist(ff));
System.out.println("目录");
l = g.getFileSize(ff);
System.out.println(path + "目录的大ؓ(f)Q? + g.FormetFileSize(l));
} else {
System.out.println("
文g个数
1");
System.out.println("文g");
l = g.getFileSizes(ff);
System.out.println(path + "文g的大ؓ(f)Q? + g.FormetFileSize(l));