Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java FTP²Ù×÷

 ¼òµ¥µÄдÁ˸öjava¶ÔftpµÄ²Ù×÷
ÓõÄÊÇcommons-net.jar°ü
FTPProxy.java
public class FTPProxy{
public FTPProxy()
{
super();
ftpClient = new FTPClient();
}
public FTPProxy(FTPBean entity)
{
this();
this.entity = entity;
}
private FTPBean entity;
private FTPClient ftpClient;
public void connection()
{
try
{
ftpClient.connect(entity.getServerIP());
ftpClient.login(entity.getUser(), entity.getPassword());
} catch (SocketException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
}
public void download()
{
FileOutputStream fos = null;
try
{
String remoteFile = entity.getSrcFile();
String remoteFileName = "";
if (0 == remoteFile.lastIndexOf("/"))
{
remoteFileName = remoteFile.substring(remoteFile
.lastIndexOf("/") + 1);
} else if (0 < remoteFile.lastIndexOf("/"))
{
remoteFileName = remoteFile.substring(remoteFile
.lastIndexOf("/") + 1);
String path = remoteFile.substring(0, remoteFile
.lastIndexOf("/"));
ftpClient.changeWorkingDirectory(path);
} else
{
remoteFileName = remoteFile;
}
fos = new FileOutputStream(entity.getTargetFile());
ftpClient.setBufferSize(1024 * 8);
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
ftpClient.retrieveFile(remoteFileName, fos);
} catch (IOException e)
{
e.printStackTrace();
} finally
{
try
{
fos.close();
ftpClient.disconnect();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
public void upload()
{
FileInputStream fis = null;
try
{
File srcFile = new File(entity.getSrcFile());
fis = new FileInputStream(srcFile);
ftpClient.setBufferSize(1024 * 8);
ftpClient.setControlEncoding("GBK");
String ftpPath = entity.getFtpPath();
if(null!=ftpPath&&!"".equals(ftpPath))
{
ftpClient.makeDirectory(ftpPath);
ftpClient.changeWo


Ïà¹ØÎĵµ£º

Ïê½âJava»Øµ÷»úÖÆ (Callback) ½²½â+ʵÀý

JavaÖеĻص÷£¨callback£©ÊǺÜÖØÒªµÄÒ»¸ö¸ÅÄspringÕûºÏhibernate´óÁ¿Ê¹ÓÃÁËÕâÖÖ¼¼Êõ¡£
¾¿¾¹ÔõÑù²ÅÊǻص÷ÄØ£¿
ÕâÊÇÍøÉÏ×î¶à¼ûµ½µÄ˵Ã÷£º   
  1.class   A,class   B   
  2.class   AʵÏÖ½Ó¿Úcallback
  3.class   BÓµÓÐÒ»¸ ......

Èý¡¢¶ÔjavaÐÂÊֵļ¸¸ö½¨Òé

    1¡¢Ñ§»áÔõôÉèÖû·¾³±äÁ¿
  ´ð°¸£ºÔÚÎҵĵçÄÔÀïÉèÖÃ
    2¡¢Ñ§»áÔõôÉèÖÃjava ³ÌÐòÊäÈë²ÎÊý
´ð°¸£ºmain ²ÎÊýÊý×é
    3   ѧ»áÔõôÉèÖà classpath·¾¶£¬ÒÔ¼°classpathÊǸÉôµÄ
´ð°¸£ºÒýÓõÄÀàµÄ·¾¶
   4    ÖªµÀjarÎÄ ......

JAVA³ÌÐòÔ±µÄǮ;

      Ç廪´óѧ³ö°æÉ硶Java³ÌÐòÔ±£¬ÉÏ°àÄǵãʶù¡·×÷ÕߣºÖÓÉù Õ½ڣº1.1С½Ú
      ÎÒÃǸոսøÈë±¾ÊéµÄÕýÌâ¾ÍÄóöÒ»¸öËײ»¿ÉÄÍ“Ç®”×ÖÀ´ºÍ´ó¼Ò´ó̸ÌØ̸£¬Î´Ãâ²»ÑÅ¡£µ«ÊÇ£¬ÎÒ»¹ÊÇÒªÔÚÒ»¿ªÊ¼¾ÍҪ˵Õâ¸öÎÊÌ⣬ÒòΪÕâÊǺܶàÅóÓѹØÐĵÄÎÊÌ⣬Ϊʲô²»ÏÈ˵ ......

JavaÏß³ÌÖ®yeild()Àí½â

²âÊÔÖз¢ÏÖÈç¹û¼¸¸ö´¦ÓÚ¿ÉÔËÐÐ״̬µÄÏ̵߳ÄÓÅÏȼ¶¶¼Ð¡ÓÚ»òÕßµÈÓÚ6ʱ£¬yield()·½·¨¿É½«ÔËÐлú»áÈøøÓÅÏȼ¶Îª6ºÍÓÅÏȼ¶Îª5µÄÏ̡߳£
¶øÈç¹ûµ÷ÓÃÁËyield()·½·¨µÄÏ̵߳ÄÓÅÏȼ¶´óÓÚ»òµÈÓÚ7ʱ£¬Ôò²»»á½«ÔËÐлú»áÈøøÆäËûÏ̡߳£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ