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.

IO / CATATAN</>
IO03 Jan 2026

How do I use FileChannel for efficient file IO?

Using FileChannel from the java.nio.channels package is a powerful way to perform high-performance file operations. It allows for advanced features like memory-mapped files and direct transfer between channels, which are often much faster than traditional stream-based I/O. Here are the most efficient ways to use FileChannel. 1. Fast File Copying with transferTo or transferFrom This […]

Wayan · 3 menit baca
IO / CATATAN</>
IO03 Jan 2026

How do I use Files.probeContentType() to detect file type?

To use Files.probeContentType(Path path) in Java, you simply pass a Path object to the method. It returns a string representing the MIME type (e.g., image/png, text/plain) or null if the type cannot be determined. Here is a practical example of how to implement it: package org.kodejava.nio; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public […]

Wayan · 2 menit baca
IO / CATATAN</>
IO02 Jan 2026

How do I zip and unzip files with Java I/O?

In Java, handling ZIP files is primarily done using the java.util.zip package. The key classes you’ll use are ZipOutputStream for creating (zipping) files and ZipInputStream (or ZipFile) for extracting (unzipping) them. Here is a breakdown of how to perform both operations. 1. Zipping Files To zip files, you wrap a FileOutputStream with a ZipOutputStream. For […]

Wayan · 3 menit baca
IO / CATATAN</>
IO02 Jan 2026

How do I use Files.walk() to traverse directories?

To use Files.walk to traverse directories, you call the method with a starting Path. It returns a Stream<Path> that lazily populates as you traverse the file tree in a depth-first manner. The most important best practice when using Files.walk is to use it within a try-with-resources block. This ensures that the underlying resources (the directory […]

Wayan · 2 menit baca
IO / CATATAN</>
IO01 Jan 2026

How do I create a temporary file with Files.createTempFile()?

To create a temporary file using java.nio.file.Files.createTempFile, you can use one of two main overloaded methods. This is part of the Java NIO.2 API and is generally preferred over the older File.createTempFile because it returns a Path object and allows for better error handling and file attributes. 1. In the Default Temporary Directory If you […]

Wayan · 2 menit baca
IO / CATATAN</>
IO01 Jan 2026

How do I use Files.lines() to process a text file line by line?

To use Files.lines() to process a text file line by line in Java, you should follow the pattern of returning a Stream<String> within a try-with-resources block. This approach is memory-efficient because it reads the file lazily, meaning it doesn’t load the entire file into memory at once. Basic Implementation package org.kodejava.nio; import java.io.IOException; import java.nio.file.Files; […]

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.