It so life
love as life
ftp
ftp之FTPConnectionClosedException解决
ftp关闭异常总结使用apache的ftp时,在数据量大的时候,在后台会报异常 org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
Apache FTP 实用代码
Apache FTP 实用代码结合网上两个使用apache commons-net包的两个优秀的代码,结合实际,写出了如下的FtpUtil,供参考! 参考网址:http://www.iteye.com/topic/173786,http://hi.baidu.com/victorlin23/blog/item/edc62a35dbae8a1a91ef3947.html
FTP的主动模式
FTP的主动模式FTP的主动模式(active mode)和被动模式(passive mode):(转) FTP的主动模式(active mode)和被动模式(passive mode):(转) 2010-03-01 23:57
JSch
JSch - Java实现的SFTP(文件上传详解篇) JSch是Java Secure Channel的缩写。JSch是一个SSH2的纯Java实现。它允许你连接到一个SSH服务器,并且可以使用端口转发,X11转发,文件传输等,当然你也可以集成它的功能到你自己的应用程序。
Validate XML using a XSD
Validate XML using a XSD1、xsd文件源; SchemaFactory: newSchema(Source schema) // Parser object is: com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl@c9ba38 Start document: Start element: local name: PHONEBOOK qname: PHONEBOOK uri: Characters: Start element: local name: PERSON qname: PERSON uri: Characters: Start element: local name: NAME qname: NAME uri: Attributes: Name : firstName Type : CDATA Value: Joe Name : lastName Type : CDATA Value: Yin Characters: Joe Characters: Yin End element: local name: NAME qname: NAME uri: Characters: Start element: local name: EMAIL qname: EMAIL uri: Characters: joe@yourserver.com End element: local name: EMAIL qname: EMAIL uri: Characters: Start element: local name: TELEPHONE qname: TELEPHONE uri: Characters: 202-999-9999 End element: local name: TELEPHONE qname: TELEPHONE uri: Characters: Start element: local name: WEB qname: WEB uri: Characters: www.java2s.com End element: local name: WEB qname: WEB uri: Characters: End element: local name: PERSON qname: PERSON uri: Characters: End element: local name: PHONEBOOK qname: PHONEBOOK uri: End document: // import java.io.StringReader; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.validation.SchemaFactory; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; public class MainClass { public static **void main(String args[])throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser parser = null; spf.setNamespaceAware(true); try { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); spf.setSchema(sf.newSchema(new SAXSource(new InputSource(new StringReader(schemaString))))); parser = spf.newSAXParser(); } catch(SAXException e) { e.printStackTrace(System.err); System.exit(1); } catch(ParserConfigurationException e) { e.printStackTrace(System.err); System.exit(1); } MySAXHandler handler = new MySAXHandler(); System.out.println(schemaString); parser.parse(new InputSource(new StringReader(xmlString)), handler); } static String xmlString = "<?xml version=\"1.0\"?>" + "" + "rtoName" + "FromName" + "Info" + "Message Body" + ""; static String schemaString ="<?xml version=\"1.0\"?>" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; } class MySAXHandler extends DefaultHandler { public **void startDocument() { System.out.println("Start document: "); } public **void endDocument() { System.out.println("End document: "); } public **void startElement(String uri, String localName, String qname, Attributes attr) { System.out.println("Start element: local name: " + localName + " qname: " + qname + " uri: "+uri); int attrCount = attr.getLength(); if(attrCount>0) { System.out.println("Attributes:"); for(int i = 0 ; i<attrCount ; i++) { System.out.println(" Name : " + attr.getQName(i)); System.out.println(" Type : " + attr.getType(i)); System.out.println(" Value: " + attr.getValue(i)); } } } public **void endElement(String uri, String localName, String qname) { System.out.println("End element: local name: " + localName + " qname: " + qname + " uri: "+uri); } public **void characters(char[] ch, int start, int length) { System.out.println("Characters: " + new String(ch, start, length)); } public **void ignorableWhitespace(char[] ch, int start, int length) { System.out.println("Ignorable whitespace: " + new String(ch, start, length)); } public **void startPrefixMapping(String prefix, String uri) { System.out.println("Start \"" + prefix + "\" namespace scope. URI: " + uri); } public **void endPrefixMapping(String prefix) { System.out.println("End \"" + prefix + "\" namespace scope."); } public **void warning(SAXParseException spe) { System.out.println("Warning at line "+spe.getLineNumber()); System.out.println(spe.getMessage()); } public **void fatalError(SAXParseException spe) throws SAXException { System.out.println("Fatal error at line "+spe.getLineNumber()); System.out.println(spe.getMessage()); throw **spe; } }
被动模式下FTP的详细工作过程
被动模式下FTP的详细工作过程 - 大浪淘沙 - 51CTO技术博客分享到 一键分享 QQ空间 新浪微博 百度云收藏 人人网 腾讯微博 百度相册 开心网 腾讯朋友 百度贴吧 豆瓣网 搜狐微博 百度新首页
被动模式下FTP的详细工作过程
被动模式下FTP的详细工作过程被动模式下FTP的详细工作过程 PASV FTP在工作的第一步,与PORT FTP一样,会首先使用21端口建立控制连接;但在第二步,由FTP客户端主动发起建立数据传输连接请求,服务器的数据传输端口为随机端口,因此,每次建立的数据传输连接通道,服务器所使用的端口都不相同。