SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API06 Jun 2008

How do I convert ResourceBundle to Map?

The following code snippet will convert a resource bundle into a map object, a key-value mapping. It will read from a file called Messages_en_GB.properties which corresponding to the Locale.UK. For example the file contain the following string. This file should be placed under the resources directory. welcome.message = Hello World! package org.kodejava.util; import java.util.*; public […]

Wayan · 2 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP02 Jun 2008

How do I decompress Java objects?

In the previous example How do I compress Java objects? we have manage to compress Java objects and stored them in file. In this example we will read the file and reconstruct the compressed objects. For the User class you can see in the previous example mentioned above. package org.kodejava.util.zip; import org.kodejava.util.support.User; import java.io.File; import […]

Wayan · 1 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP30 May 2008

How do I compress Java objects?

This example demonstrates how to compress a Java object. We compress the Java object using GZIPOutputStream, pass it to ObjectOutputStream to write the object into an external file. The object we are going to compress will be represented by the User object. We need to make the User object serializable, so it must implement the […]

Wayan · 2 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP27 May 2008

How do I read a zip file checksum value?

package org.kodejava.util.zip; import java.io.*; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; import java.util.zip.CheckedInputStream; import java.util.zip.Adler32; public class UnzipWithChecksum { public static void main(String[] args) throws Exception { String zipName = "data-1.zip"; try (FileInputStream fis = new FileInputStream(zipName); // Creating input stream that also maintains the checksum of // the data which later can be used to validate data...

Wayan · 1 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP25 May 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 min read
ZIP AND GZIP / NOTES</>↗
Zip and GZIP20 May 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 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

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

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.