Java Serialization and Deserialization Examples
In Java, Serialization means converting Java objects into a byte stream; Deserialization means converting the serialized object’s byte stream back to the original Java object. In Java, we have to…
Favourite tutorials for developers
Core Java is the fundamental form of Java. We use it in all Java platforms and technologies. Without going through core Java, it is impossible to advance to advanced Java. Unlike core Java, advanced Java is a specialization of the core Java in some particular domain, such as database handling, networking, and the web.
In Java, Serialization means converting Java objects into a byte stream; Deserialization means converting the serialized object’s byte stream back to the original Java object. In Java, we have to…
This example shows how to use ObjectInputStream to read a serialized object from a file in Java, aka Deserialization. The below example converts a Person object to bytes stream and…
This example shows how to use ObjectOutputStream to write objects to a file in Java, aka Serialization. We can serialize or marshal an object which implements a Serializable interface. We…
In Java old days, it lacks of method to determine the free disk space on a partition. But this is changed since JDK 1.6 released, a few new methods –…
This article shows how to convert a file into a hexadecimal (hex) representative format. The idea is to read the file into an InputStream and uses String.format(%X) to convert each…
This article shows a few ways to save a byte into a file. For JDK 1.7 and above, the NIO Files.write is the simplest solution to save byte to a…
In Java, we can use Files.readAllBytes(path) to convert a File object into a byte. Before Java 7, we can initiate a new byte with a predefined size (same with the…
In Java, you can use the Security.getAlgorithms("MessageDigest") to list all the available MessageDigest algorithms.
In this article, we will show you how to use a SHA-256 and MD5 algorithm to generate a checksum for a file. We have 2 ways: (1) using MessageDigest.getInstance(“algorithm”), (2)…
Most people will read the file content and assign to StringBuffer or String line by line. Here’s another trick that may interest you – how to assign whole file content…