ReFtpClient { public boolean uploadFile(String filePath, final String fileName, final byte[] b) throws IOException { return uploadFile(filePath, fileName, new BufferedInputStream(new ByteArrayInputStream(b))); } ReFtpClient(ReFtpClientConfig reFtpClientConfig);  ReFtpClient(); void init(); void connect(); boolean isActive(); void disConnect(); void destroy(); boolean uploadFile(String filePath, final String fileName, final byte[] b); boolean uploadFile(MultipartFile multipartFile); boolean uploadFile(String filePath, final String fileName, final InputStream input); Map<String, Boolean> downloadFile(String remotePath, String localPath, String fileName); Map<String, Boolean> downloadFile(String remotePath, String localPath, String[] fileNames); String getCurrentDirectoryPath(); void changeWorkingDirectory(final String path); boolean changeToParentDirectory(); boolean makeDirectory(String dirName); long getFileSize(final String fileName); boolean renameCurrentFile(final String from, final String to); List<String> listCurrentDirectoryFileNames(); List<FTPFile> listCurrentDirectoryFiles(); boolean deleteFile(String dirPath, String name); static void main(String[] args);  }
@Test void uploadFile() { ReFtpClient reFtpClient = new ReFtpClient(); reFtpClient.init(); try { reFtpClient.connect(); String originName = "C:\\Users\\ljt\\Desktop\\re.sql"; String extName = originName.substring(originName.lastIndexOf(".") + 1); InputStream inputStream = new BufferedInputStream(new FileInputStream(originName)); String filePath = ""; for (CommonFileTypeEnum commonFileTypeEnum : CommonFileTypeEnum.values()) { if (extName.equalsIgnoreCase(commonFileTypeEnum.getValue())) { int type = commonFileTypeEnum.getType(); switch (type) { case 1 : filePath = "images"; break; case 2 : filePath = "music"; break; case 3 : filePath = "documentation"; break; case 4 : filePath = "video"; break; case 5 : filePath = "pdf"; break; case 6 : filePath = "markdown"; break; case 7 : filePath = "code"; break; default: filePath = "other"; } } } reFtpClient.uploadFile(filePath, "re.sql", inputStream); } catch (IOException e) { e.printStackTrace(); } }