Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

APACHE COMMONS / CATATAN</>
Apache Commons14 Jul 2008

How do I upload file to FTP server?

This example demonstrates how to upload file to FTP server. package org.kodejava.commons.net; import org.apache.commons.net.ftp.FTPClient; import java.io.IOException; import java.io.InputStream; public class FTPUploadDemo { public static void main(String[] args) { FTPClient client = new FTPClient(); String filename = "data.txt"; // Read the file from the resources folder. ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try (InputStream is = classLoad...

Wayan · 1 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons11 Jul 2008

How do I download file from FTP server?

This example demonstrates how to download a file from FTP server. To download a file, we first connect to the FTP server and then login by supplying the username and password. To download the file we call retrieveFile() method of the FTPClient object. This method takes two parameters, the remote filename and an OutputStream of […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons10 Jul 2008

How do I connect to FTP server?

The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files between a client and server on a computer network. The example below shows you how to connect to an FTP server. In this example we are using the FTPClient class of the Apache Commons Net library. To connect to the […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons10 Jul 2008

How do I touch a file using Apache Commons IO?

This example demonstrates a touch command just like Unix touch command. If the file to be touched doesn’t exist, a new empty file will be created. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; public class TouchFileExample { public static void main(String[] args) { try { File file = new File("Touch.dat"); // Touch the file. […]

Wayan · 1 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons09 Jul 2008

How do I delete directory recursively?

Using the FileUtils.deleteDirectory() from the Apache Commons IO library, we can simplify the process of deleting directory and everything below it recursively. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; public class DeleteDirectory { public static void main(String[] args) { try { File directory = new File("F:/Temp"); // Deletes a directory recursively. When a deletion […]

Wayan · 1 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons05 Jul 2008

How do I create a human-readable file size?

This example demonstrates how to create a human-readable file size using the FileUtils class of the Apache Commons IO library. The byteCountToDisplaySize() method take the file size in bytes and return a human-readable display of the file size in bytes, kilobytes, megabytes, gigabytes, etc. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; public class ReadableFileSize { public […]

Wayan · 1 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.