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
0
votes
1 answer

Streams - ObjectOutputStream gives NULL

I have two apps that work in conjunction with one another. One is a "server" type app that does not have any GUI interface and handles queries to a database and processes requests from a client. The other is a "client" that is primarily a GUI and is…
0
votes
1 answer

Appending New Object to the existing file

Hi I have an issue when trying to append new objects to the existing file.. Once the android app has been lunched again I want to get the existing file and add a new objects then read the objects from the existing file ... Actually, when I'm…
0
votes
1 answer

ObjectOutputStream reads only the first instance given to it (java)?

Ive seen this question a couple times but I honestly dont understand how to get it to work. I have a client and server application, and the server, has a ObjectOutputStream variable, sends an array list with a double integer array in it (the reason…
Code Doggo
  • 2,146
  • 6
  • 33
  • 58
0
votes
1 answer

cannot find symbol ois

I'm writing simple client - server application but I have stupid problem with this (it simplify example (everything is ok when i don't use java serialization)): ServerSocket serversocket=null; Socket socket=null; String slowo=null; …
user1518451
  • 1,767
  • 6
  • 23
  • 26
0
votes
2 answers

Java: ObjectOutputStream with Serializable problem

I have these three classes: Command: package pack; public abstract class Command impements java.io.Serializable { public abstract void execute(); } Client: package pack; // imports.... public class Client { Socket socket; //…
Martijn Courteaux
  • 67,591
  • 47
  • 198
  • 287
0
votes
2 answers

Java Object Streams and java.io.EOFException

In a fairly simple program I wrote, I am saving an object (a game which contains a few other objects) using ObjectOutputStream. My first question is, when I remove "implements Serializable" from any of my classes, a NotSerializableException is NOT…
yts
  • 1,890
  • 1
  • 14
  • 24
0
votes
1 answer

ObjectOutputStream.writeObject() (on top of socket.getOutputStream()) throws broken pipe (IO Exception) when writing a serializable object

UPDATE: Full code example: Server: ServerSocket serverSocket = new ServerSocket(8888); Socket client = serverSocket.accept(); writer_ = new ObjectOutputStream(client.getOutputStream()); writer_.writeObject("This should be a solstice message…
Kivanc Muslu
  • 13
  • 1
  • 6
0
votes
1 answer

Save/Load HashMap with .bin

public Map barrack = new HashMap(); SavingData.save(barrack, "barrack.bin"); // save barrack = (Map)SavingData.load("barrack.bin"); // load // BarrackData contains 3 int's and 1…
0
votes
2 answers

I Can't Send objects over sockets in Java

I have this problem, and I can't figure it out whats is wrong. I have searched on all over the internet, but without success. So, I have to send an object over sockets in Java, and I can't figure out how to do it. I tried so many ways. I serialized…
bfagundes
  • 95
  • 2
  • 4
  • 16
0
votes
1 answer

Storing an ArrayList of TableRows, and reading it back: How does one do it?

I wanted to try creating a TableRow with a small group of TextViews, each of them holding a primitive String data. I thought, maybe if I store an ArrayList of these TableRows, and if successfully read/write back and forth, I would simplify a lot of…
tom_mai78101
  • 2,383
  • 2
  • 32
  • 59
0
votes
1 answer

Thread objectoutputstream objectinputstream blocking not reading

My code is ill; what looks like a fairly straightforward object write and read operation, never seems to fire its secondary operations. An inner class thread on the remote peer sends a ConcurrentHashMap over an OOS. When that arrives - and it does,…
0
votes
1 answer

Java ObjectOutputStream IOException

I made a simple object that I'm trying to send though the OOS but everytime I try to send the class that I created it throws an IOException. But if I try to send objects through that I know are serializable it doesn't throw an error. UserName…
Jake B
  • 672
  • 1
  • 9
  • 21
0
votes
1 answer

java saved file disappears (ObjectOutputStream)

well this is a strange one. The first save attampt usually works (1 more try max). but in a heavy load (many saves in a row) the saved file disappears. if uncommenting the "Thread.sleep" the error is captured otherwise the validation passes…
ozma
  • 1,633
  • 1
  • 20
  • 28
0
votes
1 answer

ClassCastException in Android when trying to read in from ObjectInputStream

I've got a problem with an android application I'm working on. I've got two phones connected through Wi-Fi and I pass a custom serialized class from one phone to the other using ObjectOutputStream / ObjectInputStream. The classes on the two phones…
0
votes
3 answers

creating a directory and then creating file inside it

I want to create an ouputStreamWriter object say "out", for a file named say "f". I want this this file f to be created in a directory or folder named "output". If the directory "output" does not exist then it should create it and if that already…
Ragini
  • 1,509
  • 7
  • 28
  • 42