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 Commons01 Sep 2008

How do I decode a Base64 encoded binary?

package org.kodejava.commons.codec; import org.apache.commons.codec.binary.Base64; import java.util.Arrays; public class Base64Decode { public static void main(String[] args) { String hello = "SGVsbG8gV29ybGQ="; // Decode a previously encoded string using decodeBase64 method and // passing the byte[] of the encoded string. byte[] decoded = Base64.decodeBase64(hello.getBytes()); // Print the decoded array System.out.println(Arrays.toString(decoded)); // Convert the decoded byt...

Wayan · 1 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons28 Agt 2008

How do I encode binary data as Base64 string?

package org.kodejava.commons.codec; import org.apache.commons.codec.binary.Base64; import java.util.Arrays; public class Base64Encode { public static void main(String[] args) { String hello = "Hello World"; // The encodeBase64 method take a byte[] as the parameter. The byte[] // can be from a simple string like in this example, or it can be from // an image file data. byte[] […]

Wayan · 1 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons16 Agt 2008

How do I sort files based on their last modified date?

This example demonstrates how to use Apache Commons IO LastModifiedFileComparator class to sort files based on their last modified date in ascending and descending order. There are two comparators defined in this class, the LASTMODIFIED_COMPARATOR and the LASTMODIFIED_REVERSE. package org.kodejava.commons.io; import static org.apache.commons.io.comparator.LastModifiedFileComparator.*; import java.io.File; import java.util.Arrays; public class FileSortLastModified { public sta...

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

How do I search for files recursively using Apache Commons IO?

This example demonstrates how we can use the FileUtils class listFiles() method to search for a file specified by their extensions. We can also define to find the file recursively deep down into the subdirectories. package org.kodejava.commons.io; import org.apache.commons.io.FileUtils; import java.io.File; import java.util.Collection; public class SearchFileRecursive { public static void main(String[] args) { File root […]

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

How do I delete file from FTP server?

This example demonstrates how to delete file from FTP server. package org.kodejava.commons.net; import org.apache.commons.net.ftp.FTPClient; import java.io.IOException; public class FTPDeleteDemo { public static void main(String[] args) { FTPClient client = new FTPClient(); try { client.connect("ftp.example.com"); client.login("demo", "password"); // Delete file on the FTP server. When the FTP delete // process completes, it returns true. String filename […]

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

How do I get a list of files from FTP server?

This example demonstrates how to retrieve a list of files from FTP server. First we create an instance of org.apache.commons.net.ftp.FTPClient. Connect to the FTP server and login with your username and password. The listFiles() method of the FTPClient return the list of filenames contained in the current working directory. null if the list could not […]

Wayan · 2 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.