I was going through a blog and one question came to my head. Is it possible to overwrite the way ObjectOutputStream is writing.
Let's say i am writing to a file out.dat i.e.
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File("C:\\out.dat")));
out.writeObject(o);
When i opened the file out.dat in Notepad++, i saw the binary data. Which makes sense. What if, I would like to customize the way this data is being written. Lets say i want my out.dat file in JSON format (Thats just an example, It could be any other format). What method should i overwrite to do this?