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
2 answers

How to better debug nullpointer exceptions in Java

I'm creating a Client/Server program that will send a serializable object back and forth. i have no idea how that nullpointer exception occurs it points to the line where the btnSave responds to the Click event, and the OutputStream object tries to…
joe
  • 546
  • 1
  • 6
  • 20
2
votes
0 answers

GetFieldID: unable to find field Ljava/util/HashMap;.loadFactor:F

My Android app serializes objects (with ObjectOutputStream). Each time I deserialice one (with ObjectInputStream), I get lots of debug messages like this: 01-20 06:44:22.274: D/dalvikvm(2204): GetFieldID: unable to find field…
hpique
  • 119,096
  • 131
  • 338
  • 476
2
votes
2 answers

Object sent via ObjectStreams do not keep their field values?

I've been developping a chat client/server to get familiar with java, and I've run into a logic bug I don't understand. I'm sending an object through a ObjectOutputStream (Message object, see ref), which contains fields and another object, which has…
2
votes
3 answers

Sending Java object of an unknown class

searching for a long time, but didn't find any answer on that one: I have a server and I have a client. The server should receive an object via ObjectInputStream and ObjectOutputStream. That already works for any class, known on the server. Now I…
2
votes
2 answers

Exception catch on ObjectOutputStream

In my software i need to send messages between client and server through an ObjectOutputStream. The core of the sender method is the following: .... try { objWriter.writeUnshared(bean); objWriter.flush(); } catch (Exception e) { …
Matteo Gatto
  • 616
  • 11
  • 28
2
votes
2 answers

Store the actual class logic/blueprint and load it again

If I have a class like this: class Foo implements HasBarMethod { public double bar(double x) { return x*x; } } Now I have Foo foo = new Foo(); someObjectOutputStreamToSomeFile.writeObject(foo); which is executed. Later I decide to change…
Herbert
  • 5,279
  • 5
  • 44
  • 69
2
votes
1 answer

IKVM.NET object serialization with ObjectOutputStream differences

I have a java program (jar) that serialize a class to file with ObjectOutputStream. I need to use this part of the program inside a .NET project and to do so i have converted the jar to a .NET dll with ikvmc.exe. Everything works fine but the…
Luca Looz
  • 271
  • 3
  • 15
2
votes
2 answers

Java - Sending byte object over socket

I'm using an ObjectOutputStream over my socket because I created a new class that needs to be transported between the client and the server. I also created a unique thread that sends one byte every one second over the stream to the server in order…
Onca
  • 1,113
  • 3
  • 17
  • 31
2
votes
1 answer

(objectinputstream) ObjectInput.readObject() is giving me an empty object

I have this class: public class SaveState implements Serializable { private static final long serialVersionUID = 1L; public List downloadedMagazinesIds = new ArrayList();//id's de revistas descargadas public List
2
votes
2 answers

OutputStream delete file contents JAVA

I have files in who I need to record serialized object. I open ObjectOutputStream for writing in files. If I didn't wrote nothing in file, file content get deleted. I don't want content to be deleted when I make ObjectOutputStream. My code (I use…
QBox
1
vote
3 answers

Closing the stream only if it's opened

Consider this code: FileOutputStream stream=null; ObjectOutputStream objStr=null; try { stream=new FileOutputStream(defaultFile); objStr=new ObjectOutputStream(stream); objStr.writeObject(obj); …
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
1
vote
0 answers

InputStream object method close() crashes on real device

I am programming a simple I/O system to store data needed by my Android application. I use an ObjectInputStream with the following initialization ("context" is the object obtained with getApplicationContext(): ObjectInputStream ois = new…
user1267776
1
vote
0 answers

unable to transfer transferring image via Bluetooth android

I am developing an application on android that share contact info + picture I have class Stuff that contains whole info. import java.io.Serializable; public class Stuff implements Serializable { private String name; private String…
Ahmed
  • 814
  • 2
  • 19
  • 38
1
vote
2 answers

ObjectInputStream.readObject() hangs forever during the process of socket communication

I have encountered a problem of socket communication on linux system, the communication process is like below: client send a message to ask the server to do a compute task, and wait for the result message from server after the task completes. But…
Shawn Lee
  • 161
  • 1
  • 2
  • 9
1
vote
2 answers

Android and ObjectOutputStream to resource file

I'm really new to Android development, and my first project was a simple game which has a display and a logic part. I would like to add a save feature to the game, but I'm having trouble with the implementation. I would like to do it this way, with…
Balázs Édes
  • 13,452
  • 6
  • 54
  • 89