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

ObjectOutputStream throws java.io.StreamCorruptedException

I'm trying to load an object via ObjectOutputStream using sockets. I'm testing on the same machine. I receive this error: java.io.StreamCorruptedException: invalid type code: 00 at java.io.ObjectInputStream.readObject0(Unknown Source) at…
felipe
  • 1,212
  • 1
  • 15
  • 27
0
votes
2 answers

Sending encrypted file over socket

I'm having some issues with sending an encrypted file over a socket (client-server communication). I think this is an issue related with the streams (more specifically the arrangement of streams seems to be rather complex, since I'm making data…
besnico
  • 253
  • 2
  • 4
  • 13
0
votes
2 answers

Can I save ImageIcon with ObjectOutputStream?

Does anybody know if you can save an ImageIcon file with ObjectOutputStream? I have a person-registry that I save with an ObjectOutputStream, So it would be really convenient to to write the the imageicon together with that information. But when I…
0
votes
4 answers

Java socket objectoutputstream multi-thread

I'v got code which use multi-thread to send object to ServerSocket (currently localy, but in future in local net) Used for sending object: public class SocketToAdapter { public static void writeObject(Object object) { try { …
user1055201
  • 159
  • 7
  • 16
0
votes
1 answer

multi client chat server throwing exceptions and not allowing connections after disconnect

It's hard to fit it in the title but every time a client disconnects, a lot of exceptions are thrown and the server does not allow any more connections after the DC. Here is the error i get: java.net.SocketException: Socket closed at…
0
votes
3 answers

Is it possible to use multiple java ObjetOutputStream objects to write to a single java ObjectInputStream object?

I have a standard client/server setup. The program I'd like to build acts a lot like a mail office(which is my Server). Multiple people (client with ObjectOutputStream) hand the office (server with the single ObjectInputStream) mail with an attached…
Lucas
  • 1,149
  • 1
  • 9
  • 23
0
votes
1 answer

How do I switch between String I/O and Object I/O streams in Java?

I'm creating a client-server application wherein the server or client sends strings using PrintStream and reads strings using BufferedReader/InputStreamReader. Eventually, I need to either send an object from the server to the client or vice versa…
0
votes
2 answers

ObjectOutputStream not saving in custom class

I made my own custom class, and I can't figure out what's wrong with it. More specifically my question is what differences exist between making a class for android instead of Java. I mean, according to the logCat it doesn't throw any errors or…
0
votes
1 answer

ObjectOutputStream(FileOutputStream) pointer modification

I can't understand if doing what is said in the title with the streams, if I use the object stream to write an object to a file, does it shift the filestream's pointer and when I use it, after, to write something, it writes it after the…
besnico
  • 253
  • 2
  • 4
  • 13
0
votes
2 answers

Saving Objects to File. Custom methods to add/remove Object

I want to be able to save the objects created in my program to a file. I have watched a few tutorials on ObjectOutputStream, but the problem is, they only show how to save a specific object created in the main method. What I want, I that the program…
0
votes
2 answers

Java streams with EOFException

I wrote some client - server program, that shares data but at server side i got EOFException after reciving data. I tried to fix it on my own but it is hard to find own errors. The error is caused by this line: Message command =(Message)…
Filip
  • 49
  • 2
  • 7
0
votes
4 answers

Serializable simple Object IOException

Found the solution: you have to open the Streams like this: FileInputStream inputStream = openFileInput(FILENAME); ObjectInputStream ois = new ObjectInputStream(inputStream); Same with Output. This fixed it for me, should anyone stumble upon this…
Adrian Jandl
  • 2,985
  • 4
  • 23
  • 30
0
votes
1 answer

Invalid stream header 434B0005 from client to server

I've serialized some objects so I can convert them to byte arrays for a TCP packet. When I send the objects from the server program to the client program, there are no issues and it works fine. However, even though the code between the server and…
0
votes
4 answers

save Linked List in Notepad.txt

I draw many triangle polygons and store it in Linked List. My problem is that, when I store the drawing in a Notepad file, the data is unreadable (weird symbol). When I try to print it using println the output is like this …
Jessy
  • 15,321
  • 31
  • 83
  • 100
0
votes
1 answer

Read data from a client using ObjectInputStream and ObjectOutputStream connected to a client

I have code that is similar to the code below. The problem that I'm having is that when the ObjectInputStream (the input variable) tries to read an object (which will only happen after the connection has been established), it crashes and gives me an…