Home » Tag Archives: Serialization

Tag Archives: Serialization

The Serialization Proxy Pattern

java-design-patterns-logo_scaled

In my last post, I talked about serialization in general. This one is much more focused and presents a single detail: the Serialization Proxy Pattern. It is a good, often the best, way to deal with many of the issues with serialization. If there was only one thing a developer would want to know about the topic, I’d tell him ...

Read More »

Concepts of Serialization

java-logo

With all this talk about why Optional isn’t serializable and what to do about it (coming up soon), let’s have a closer look at serialization. Overview This post presents some key concepts of serialization. It tries to do so succinctly without going into great detail, which includes keeping advice to a minimum. It has no narrative and is more akin ...

Read More »

Serialization Proxy Pattern example

java-logo

There are books, which change your life immensely. One of such books is “Effective Java” by Joshua Bloch. Below you may find small experiment, which was inspired by Chapter 11 of this book – “Serialization”. Suppose that we have a class designed for inheritance, which is not Serializable itself, and has no parameterless constructor, like in this example:     ...

Read More »

Why use SerialVersionUID inside Serializable class in Java

java-logo

Serialization and SerialVersionUID is always remains a puzzle for many Java developers. I often see questions like what is this SerialVersionUID, or what will happen if I don’t declare SerialVersionUID in my Serializable class? Apart from complexity involved and rare use, one more reason of these questions is Eclipse IDE’s warning against absence of SerialVersionUID e.g.“The Serializable class Customer does ...

Read More »

Externalizable in java

java-logo

Before understanding Externalizable interface, you need to have idea about Serialization.You can read more about Serialization at Serialization in java. Java provides mechanism called serialization to persists java objects in a form of ordered or sequence of bytes that includes the object’s data as well as information about the object’s type and the types of data stored in the object. ...

Read More »

Serializing Java Objects with Non-Serializable Attributes

java-logo

There are multiple reasons one might want to use custom serialization instead of relying on Java’s default serialization. One of the most common reasons is for performance improvements, but another reason for writing custom serialization is when the default serialization mechanism is unsupported. Specifically, as will be demonstrated in this post, custom serialization can be used to allow a larger ...

Read More »

ObjectStreamClass: Peeking at a Java Object’s Serialization

java-logo

ObjectStreamClass can be a useful class to analyze the serialization characteristics of a serialized class loaded in the JVM. This post looks at some of the information this class provides about a loaded serialized class. ObjectStreamClass provides two static methods for lookup of a class: lookup(class) and lookupAny(Class). The first, lookup(Class), will only return an instance of ObjectStreamClass when the ...

Read More »

Lambda, will it serialize?

java-interview-questions-answers

So I have been ponder an enhancement required on the Tyrus project that would allow a user to broadcast to a subset of client connected to a URL across a cluster of machines. There are various way of doing this; but since I was playing with JDK 8 this problem definitely looked like a nail.   To this end I ...

Read More »

Using serialization to find dirty fields in an object

java-logo

Say you are developing a framework to auto-save objects into a database. You need to detect changes made between two saves, so that only modified fields are saved. How to detect dirty fields. The easiest way to do this is to traverse through the original data and the current data and compare each field separately. Code as below:     ...

Read More »

Speed Up with Fast Java and File Serialization

java-logo

Since the first version of Java, day-by-day many developers have been trying to achieve at least as good of performance as in C/C++. JVM vendors are doing their best by implementing some new JIT algorithms, but there is still a lot to do, especially in how we use Java. For example, there is a lot to win in objects<->file serialization ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close