java ftpÉÏ´«ºÍÏÂÔØ
Ê×ÏÈ£¬½¨3¸ö½Ó¿Ú
FTPOperate.java:
public interface FTPOperate
{
public void execute(FTPBean entity);
}
FTPProxy.java:
public interface FTPProxy
{
public void connection();
public abstract void upload();
public abstract void download();
public void setEntity(FTPBean entity);
}
FTPBean.java:
public interface FTPBean
{
public abstract String getServerIP();
public abstract void setServerIP(String serverIP);
public abstract String getUser();
public abstract void setUser(String user);
public abstract String getPassword();
public abstract void setPassword(String password);
public abstract String getSrcFile();
public abstract void setSrcFile(String srcFile);
public abstract String getTargetFile();
public abstract void setTargetFile(String targetFile);
public abstract String getFtpPath();
public abstract void setFtpPath(String ftpPath);
}
È»ºó·Ö±ðʵÏÖÕâÁ½¸ö½Ó¿Ú£º
FTPProxyImpl.java:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.SocketException;
import org.apache.commons.net.ftp.FTPClient;
import com.kt.iptv.common.ftp.FTPBean;
import com.kt.iptv.common.ftp.FTPProxy;
public class FTPProxyImpl implements FTPProxy
{
public FTPProxyImpl()
{
super();
ftpClient = new FTPClient();
}
public FTPProxyImpl(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
Ïà¹ØÎĵµ£º
ÄÜͨ¹ýJavaÀ´²Ù×÷Word»òÕßExcelµÄapi£¬¾ÝÎÒËùÖªµÄÓÐÕâЩ£¬¶¼¿¼²ìÁËһϣ¬¿ªÔ´µÄ³ýÁËOpenofficeºÍofficewriter¶ÔWordµÄ±í¸ñÓкõÄÖ§³ÖÍ⣬ÆäËû¶¼ºÜ²»×¨Òµ£¬»òÕß²»Ö§³Ö¡£
jacob http://sourceforge.net/projects/jacob-project/
JACOB is a JAVA-COM Bridge that allows you to call COM Automation components from Java. ......
Date ---->String
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.fomat(new Date());
String ---->Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("2010-03-16");
ÈÕÆڱȽϴóС£¬Õâ¾ÍÓõ½ÁËDateÀàÖеÄbefore()ºÍafter()·½· ......
=====suppose such a method:
public static void openFile(String fileName, PrintWriter stream) throws FileNotFoundException
{
stream = new PrintWriter(fileName);
}
=====then we want to use it this way:
PrintWriter toFile = null;
try
{
openFile("data.txt", t ......
Java enum ö¾ÙÀàÐÍ
ö¾ÙÀàÐÍÊÇÒ»¸ö³£Á¿¼¯ºÏµÄÊý¾ÝÀàÐÍ¡£
ÒòΪ¶¼Êdz£Á¿£¬ËùÒÔÒ»¸öö¾ÙÀàÐÍÖеÄ×Ö¶ÎÃû¶¼Òª´óд¡£
ÔÚJAVAÖУ¬Ã¶¾ÙÀàÐ͵Ķ¨ÒåÊÇͨ¹ý“enum“¹Ø¼ü×Ö½øÐеġ£ÀýÈçÄãÒª¶¨Òå
Ò»¸ö±íʾһ¸öÐÇÆÚµÄÿһÌìµÄö¾ÙÀàÐÍ£º
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY ......
JavaÖжÑÕ»µÄ¸ÅÄȻÊÇÂß¼Éϵģ¬ÔÚÍêÈ«·ûºÏJava¹æ·¶µÄJava´¦ÀíÆ÷ÃæÊÀ֮ǰ£¬ËùÓÐJavaÐéÄâ»úÌṩµÄÄÚÈݶ¼ÊÇÓÉÈí¼þÄ£Äâ³öÀ´µÄ¡£
ʲô½Ð¶Ñ£¿ÄãÓÃÊ®¼¸¸öÂ齫ÅÆÊúÖ±µþ³ÉÒ»ÞûÕâ½Ð¶Ñ£¬Äã¿ÉÒÔ´ÓÉÏÃæ¡¢ÏÂÃæ¡¢ÖмäÈÎÒâ³é³öÒ»ÕÅÅÆ£¬Ò²¿ÉÒÔÈÎÒâ²åÈëÒ»ÕÅ¡£
ʲô½ÐÕ»£¿AK-47µÄµ¯Ï»¾ÍÊÇÒ»¸öÕ»£¬ÔÚÉÏÃæµÄ×Óµ¯Ã»±»È¡³ö֮ǰ£¬ÄãÎÞ·¨È¡³öÏÂà ......