https://github.com/buzzcosm/ftp-client-integration-example
Apache FTPClient Integration Example
https://github.com/buzzcosm/ftp-client-integration-example
ftp-client java lombok spring-boot
Last synced: about 2 months ago
JSON representation
Apache FTPClient Integration Example
- Host: GitHub
- URL: https://github.com/buzzcosm/ftp-client-integration-example
- Owner: buzzcosm
- Created: 2025-02-20T10:51:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-20T11:34:49.000Z (over 1 year ago)
- Last Synced: 2025-02-20T12:29:56.900Z (over 1 year ago)
- Topics: ftp-client, java, lombok, spring-boot
- Language: Java
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Apache FTPClient Integration Example
Examples:
- [Baeldung: Implementing a FTP-Client in Java](https://www.baeldung.com/java-ftp-client)
### Unit-Tests
FTP-Client: `src/test/java/com/buzzcosm/ftpclient/integration/example/ftp/*`
### Straightforward Implementation
FTP-Client: `FtpClientIntegration.java`
### Interface Implementation
> better architecture
FTP-Client: `FtpClientServiceImpl.java`
Use of the FTP client in a process scenario:
```java
public class Main {
public static void main(String[] args) {
FtpClientService ftpClient = FtpClientBuilder.builder()
.host("ftp.example.com")
.port(21)
.credentials("user", "password")
.build();
try {
ftpClient.connect();
// download files
ByteArrayOutputStream file1 = ftpClient.downloadFile("/file1.txt");
ByteArrayOutputStream file2 = ftpClient.downloadFile("/file2.txt");
// processing
processFile(new ByteArrayInputStream(file1.toByteArray()));
processFile(new ByteArrayInputStream(file2.toByteArray()));
ftpClient.disconnect();
} catch (IOException e) {
log.error("FTP Error", e);
}
}
public static void processFile(InputStream isFile) throws IOException {
// ...
}
}
```