List of usage examples for org.apache.commons.net.ftp FTPClient site
public int site(String parameters) throws IOException
From source file:org.limy.common.util.FtpUtils.java
/** * FTP????/*www . j a v a 2 s .c o m*/ * @param client FTP * @param rootPath * @param relativePath ?? * @param contents * @return ???? * @throws IOException I/O */ public static boolean uploadFileFtp(FTPClient client, String rootPath, String relativePath, InputStream contents) throws IOException { int cwd = client.cwd(rootPath); if (cwd == FTPReply.FILE_UNAVAILABLE) { // ??????? if (rootPath.startsWith("/")) { mkdirsAbsolute(client, rootPath); } else { mkdirs(client, rootPath); } } LOG.debug("uploadFileFtp : " + rootPath + " ->" + relativePath); String targetDir = UrlUtils.getParent(relativePath); if (targetDir.startsWith("/")) { mkdirsAbsolute(client, targetDir); } else { mkdirs(client, targetDir); } client.cwd(rootPath); client.setFileType(FTP.BINARY_FILE_TYPE); client.site("chmod 664 " + relativePath); return client.storeFile(relativePath, contents); }