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.

CORE API / CATATAN</>
Core API18 Feb 2010

How do I use a FileChannel to read data into a Buffer?

The example below show how to use a FileChannel to read some data into a Buffer. We create a FileChannel from a FileInputStream instance. Because a channel reads data into buffer we need to create a ByteBuffer and set its capacity. Read data from a channel into buffer using the FileChannel.read() method. To read out […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API16 Feb 2010

How do I create a NIO Buffer?

This post show you how to use the java.nio buffer such as ByteBuffer, CharBuffer, DoubleBuffer, etc. To create a buffer you can use the allocate(int capacity) method. Each buffer object has the allocate(int capacity) method. You need to pass the value of the capacity of the buffer to be created when calling this method. package […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API13 Feb 2010

How do I copy file using FileChannel class?

The example below show you how to copy a file using the java.nio.channels.FileChannel class. package org.kodejava.io; import java.io.*; import java.nio.channels.FileChannel; public class FileCopy { public static void main(String[] args) { //// Define the source and target file File source = new File("D:/Temp/source.txt"); File target = new File("D:/Temp/target.txt"); // Create the source and target channel try […]

Wayan · 1 menit baca
SERVLET / CATATAN</>
Servlet13 Feb 2010

How do I create zip file in Servlet for download?

The example below is a servlet that shows you how to create a zip file and send the generated zip file for user to download. The compressing process is done by the zipFiles method of this class. For a servlet to work you need to configure it in the web.xml file of your web application […]

Wayan · 3 menit baca
GOOGLE GSON / CATATAN</>
Google Gson10 Feb 2010

How do I convert Map into JSON?

This example show you how to convert a java.util.Map into JSON string and back to Map again. package org.kodejava.gson; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; public class MapToJson { public static void main(String[] args) { Map<String, String> colours = new HashMap<>(); colours.put("BLACK", "#000000"); colours.put("RED", "#FF0000"); colours.put("GREEN", "#008000");...

Wayan · 2 menit baca
GOOGLE GSON / CATATAN</>
Google Gson08 Feb 2010

How do I convert collections into JSON?

This example show you how to convert Java collections object into JSON string. For Student class use in this example you can find it the previous example on How do I convert object into JSON?. package org.kodejava.gson; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.kodejava.gson.support.Student; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; public class […...

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