Questions tagged [externalizable]

Externalizable is a java interface that allows the user to define serialization behavior.

47 questions
2
votes
1 answer

Do I need explicit default constructor when implementing Externalizable?

I know that if class A implements Externalizable it should have no-arg constructor, but if class doesn't have any constructors (like my A class) java provides empty no-arg constructor for it. So why I have an error there? If I explicitly add no-arg…
Denys_newbie
  • 1,140
  • 5
  • 15
2
votes
1 answer

Why Externalizable when read/writeObject method are there in serializable

I am not able to clear this confusion of mine, Externalizable is used because we can give our own (more efficient) implementation of serialization-deserialization using read/writeExternal method. And control the serialization process. We can also…
RaT
  • 1,134
  • 3
  • 12
  • 28
2
votes
3 answers

Handle deserialization when datatype of class field changed

I have a serializable class. public class Customer implements Externalizable { private static final long serialVersionUID = 1L; private String id; private String name; public String getId() { return id; } public…
Poulami
  • 1,047
  • 3
  • 13
  • 27
2
votes
1 answer

customization is possible with serialization then why Externalizable at all?

I have read these articles on SO: Externalizable or Serializable?, What is the difference between Serializable and Externalizable in Java?. but my question is what extra customization could be derived by implementing Externalizable as compared to…
brain storm
  • 30,124
  • 69
  • 225
  • 393
2
votes
1 answer

how to create an eclipse plugin to auto create read/ writeExternal methods of existing class

How to create eclipse plugin to auto create the serialization code read/writeExternal on existing code java classes? Steps needed get the class from active tab (and or info on class field info like one in outline window) and generate code for each…
Amit Sehgal
  • 73
  • 1
  • 4
1
vote
1 answer

Migrating Old Serialized Data to Externalizable Data

I am working with a Spring JPA database and am attempting to migrate old Serializable objects to Externalible ones (for future data restructures, etc). Example Structure - Entity (Encryption Convertor) Serializble Field My goal is to take this…
1
vote
0 answers

How do I write to a memory mapped file using a writeExternal (Externalizable interface) method?

I hava a memory mapped file where I can write values as follows: public class HelloWorld{ public static void main(String []args){ try { // OPEN MAPPED MEMORY FILE file = new…
M.E.
  • 4,955
  • 4
  • 49
  • 128
1
vote
1 answer

What is the use of the java Externalization when custom serialization is possible by overriding the writeObject() and readObject()?

I am learning java serialization and i have a doubt, if one can customize the default serialization process by overriding the writeObject() and readObject() methods in class then what is the use of the Externalizable interface? in which scenario it…
Shivayan Mukherjee
  • 766
  • 3
  • 10
  • 33
1
vote
2 answers

Codename One - Externalizable object not supported in web service

I have created a CN1 web service which some custom objects that I want to externalize in order to send over the network. I read through several articles on how to create the web service and how to work with the CN1 Externalizable interface. This…
Lequi
  • 539
  • 2
  • 13
1
vote
2 answers

Externalization in java

I am trying to put an object into a file and then later on trying to read the same object using Externalizable interface and i am getting an Exception No valid constructor for Car class. import java.io.*; class Base { int a; } class Car extends…
1
vote
1 answer

Is there a way to make readExternal() use another constructor?

I was trying to implement readExternal from the Externalizable interface in order to serialize my big object more efficiently when I realised there is no way I can make a new object (and use it) within that method. The point is that my efficient…
1
vote
0 answers

Externalization Java Object - HashMap

Externalizable interface seems to be hard to use. Reasons Strings in an object can be null. So, I have create and serialize flags to mentioned weather or not to do inReader.readUTF() For Java Lists its even more hard. I am not sure, what is the…
Sandeep Jindal
  • 14,510
  • 18
  • 83
  • 121
1
vote
1 answer

Externalize a final instance variable

Here's my sample code: public class ExternalizableClass implements Externalizable { final int id; public ExternalizableClass() { id = 0; } public ExternalizableClass(int i) { id = i; } @Override public void…
OneZero
  • 11,556
  • 15
  • 55
  • 92
1
vote
2 answers

Serializable and Externalizable. Difference of constructor invocation while deserialization

I have read following article: http://javapapers.com/core-java/externalizable-vs-serializable/ In object de-serialization (reconsturction) the public no-argument constructor is used to reconstruct the object. In case of Serializable, instead…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
1 answer

Implement Externalizable, so that you can save the most space

I have the class Element, which has the following attributes (see class). Since the range of the two integer values are very small, I want to store them in a short. This does not work for me. I want to work with the bitshifting. What am I doing…
Stift
  • 1
  • 1