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
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

ZIP AND GZIP / CATATAN</>
Zip and GZIP25 Mei 2008

How do I create checksum for a zip file?

This example demonstrate how to use CheckedOutputStream for creating a checksum of a zip file. Checksum can be used to detect whether a data was corrupted during a transmission process to a remote machine. package org.kodejava.util.zip; import java.io.*; import java.util.Objects; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import java.util.zip.CheckedOutputStream; import java.util.zip.Adler32; public class ZipWithChecksum { public static void […]

Wayan · 2 menit baca
ZIP AND GZIP / CATATAN</>
Zip and GZIP20 Mei 2008

How do I decompress a zip file using ZipFile class?

In this example we use the java.util.zip.ZipFile class to decompress and extract a zip file. package org.kodejava.util.zip; import java.util.zip.ZipFile; import java.util.zip.ZipEntry; import java.util.Enumeration; import java.io.*; public class ZipFileUnzipDemo { public static void main(String[] args) throws Exception { String zipName = "data.zip"; ZipFile zip = new ZipFile(zipName); Enumeration<? extends ZipEntry> enumeration = zip.entries(); while (enumeration.hasMoreEleme...

Wayan · 1 menit baca
ZIP AND GZIP / CATATAN</>
Zip and GZIP16 Mei 2008

How do I decompress a zip file using ZipInputStream?

The code below shows how to decompress and extract files from a zip archive. In the example we use the java.util.zip.ZipInputStream class. package org.kodejava.util.zip; import java.io.*; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; public class UnzipDemo { public static void main(String[] args) { String zipName = "data.zip"; try (FileInputStream fis = new FileInputStream(zipName); ZipInputStream zis = new ZipInputStream(new […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API15 Mei 2008

How do I check if a string is a valid date?

The following code can be used to validate if a string contains a valid date information. The pattern of the date is defined by the java.text.SimpleDateFormat object. When the date is not valid a java.text.ParseException will be thrown. package org.kodejava.text; import java.text.SimpleDateFormat; import java.text.ParseException; public class DateValidation { public static void main(String[] args) { SimpleDateFormat […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API13 Mei 2008

How do I get Java Home directory?

To get Java Home directory we can obtain it from system properties using the java.home key. package org.kodejava.lang; public class JavaHomeDirectory { public static void main(String[] args) { String javaHome = System.getProperty("java.home"); System.out.println("JAVA HOME = " + javaHome); } } On my computer this code give me the following output: JAVA HOME = C:\Program Files\Java\jdk-17

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API10 Mei 2008

How do I get the username of operating system active user?

This example show you how to get operating system active user’s login name. We can obtain the username of current user by reading system properties using the user.name key. package org.kodejava.lang; public class GettingUserName { public static void main(String[] args) { String username = System.getProperty("user.name"); System.out.println("username = " + username); } }

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.