Questions tagged [objectoutputstream]

The Java ObjectOutputStream serialization class from the Java standard library.

ObjectOutputStream is a class from the Java standard library that can be used to serialize and write objects previously that can later be read and deserialized by an ObjectInputStream instance.

566 questions
-2
votes
1 answer

Serializing Custom Objects in Java - java.io.FileNotFoundException

I have a method that is requiring me to serialize objects of a custom class 'Fraction'. When I attempt to save the object, I get a java.io.FileNotFoundException. What could I do to help alleviate the issue? public static void method3() { …
-2
votes
2 answers

FileOutputStream with java 8 and try with resource gettng error

I am writing serialization code for eclipse I am trying to use FileOutputStream with try-with-resource but I am getting a error message : "Resource specification not allowed here for source level below 1.7" And as fix Eclipse is showing the message…
-2
votes
2 answers

Reading/Writing objects to file returning null

I'm trying to read and write objects into a file. Reading the output into a new object works, but every value is null. Here's the code: public void read() throws Exception { try { FileInputStream fIn = new…
geger42 _
  • 15
  • 5
-2
votes
1 answer

Cannot see the contents of the array printed in console

public RMI post(PrintStream stream, Object object) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); // oos.writeObject(System.rmi); oos.flush(); …
-2
votes
1 answer

How to Serialize ImageIcon Object?

I am trying to build a client-server Program in which the server sends the image to client and client displays the received image in JFrame. I am converting Image on the server-side to ImageIcon object and sending it to the client via…
ck0049
  • 1
  • 3
-2
votes
1 answer

NotSerializableException when sending an Object

I want to create an instance , put it on a container and send it. TransferContainer container = null; ... Class aClass = container.getByteCode(); o = aClass.newInstance(); ....// Some code ... container.setInstance(o); …
user567
  • 3,712
  • 9
  • 47
  • 80
-2
votes
1 answer

loading file to java application

I am trying to load a file which I saved of a simple class. Below you can find my code which im using to load, the class which I need to cast is NewClientClass. JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(null); …
-2
votes
1 answer

Serializing object with java

I am trying to serialize an object with ObjectOutputStream and FileOutputStream, however an error with the class name is being shown. JFileChooser fc = new JFileChooser(); NewClientClass AddClient = new NewClientClass(IDNumber.getText(),…
-3
votes
1 answer

Java serialization on Processing

I understand the whole concept, however trying it on Processing 3.5.3 doenst make it work, and i feel like i am missing something, and yet after hours of searching on serialiazation i got this code import java.io.*; import java.util.*; void setup()…
Bleiserman ADN
  • 141
  • 1
  • 1
  • 6
-3
votes
1 answer

Error using ObjectStream to send SQLiteDatabase

I'm using ObjectInputStream/ObjectOutputStream to send an object. I'm trying to send an SQLiteDatabase but I'm getting an error when doing so. java.io.WriteAbortedException: Read an exception; java.io.NotSerializableException:…
-3
votes
1 answer

Why create byte array in loop and copy it

I don't understand why create byte array in loop and copy it.If I don't create array in loop, code won't work.please explain to me ObjectOutputStream outt = new ObjectOutputStream(socket.getOutputStream()); InputStream f=new…
1 2 3
37
38