Questions tagged [objectinputstream]

The Java `ObjectInputStream` deserialization class from the Java standard library.

ObjectInputStream is a class from the Java standard library that can be used to read and deserialize objects previously serialized by an ObjectOutputStream instance.

589 questions
-1
votes
1 answer

NullPointerException from ObjectInputStream

I am getting a NullPointerException when I amtrying to get an Object through ObjectInputStream via a Socket. I am using a server to send information to the client (android phone) through a TransferObject. I know the server is sending the Object…
-1
votes
1 answer

How To Unblock Java ObjectInputStream?

In my program I am using ObjectInput and ObjectOutput streams between a server and client. While working on my project I have made lots of side test classes and projects to test out new tools to me, sometimes when I make an ObjectInputStream it gets…
-1
votes
1 answer

Exception in thread "main" java.io.StreamCorruptedException: invalid type code: AC

Just trying to read a number. I'm implementing Serializable and my main() throws an error: Exception in thread "main" java.io.StreamCorruptedException: invalid type code: AC at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1379) …
JCoder
  • 151
  • 1
  • 3
  • 16
-1
votes
2 answers

How to read objects sent over objectOutputStream on a socket server in Java

I have the send working but the server side wont receive the object sent in the data input stream. The class is serialized and works when sending but I'm not sure why it is not being received by the server. Here is my code: Server.ois = new…
Tyler Songer
  • 52
  • 1
  • 9
-1
votes
1 answer

Behavior of ObjectInputStream (Android) if no object is present

I'm trying to make a fairly simple Android project and need to wrap my head around data storage on the platform. I found some code that seems to do something similar to what I want to do. However, I'm curious what the behavior is of the 'readObject'…
Canadian Coder
  • 725
  • 1
  • 14
  • 35
-1
votes
1 answer

Unhandled ClassNotFound Exception when reading object

So, I'm trying to read in an Object from a file, and I can't figure out why I'm getting this exception, or how to fix it. Maybe you guys can help me out? I've tried messing around with the way I read the object, but can't get it quite right. Here is…
dlynch
  • 23
  • 8
-1
votes
2 answers

Java ObjectInputStream Won't Read Object?

I am having a problem where I can connect to my ServerSocket and send Objects (A custom Packet class to be exact) to my client, but when I use the readObject() method, my code hangs and doesn't read any packets. Here is the Client code: public class…
MrLolEthan
  • 76
  • 2
  • 9
-1
votes
1 answer

Android: OptionalDataException upon ObjectInputStream.readObject()

Situation : From my Android server, I'm sending a simple String OBJECT to the client. I use ObjectOutputStream at the server, and ObjectInputStream at the client. Server code: mOutput.flush(); mOutput.reset(); …
-1
votes
1 answer

Communicating with multiple clients - Java Server

I have implemented a small Java chatroom program, where clients can communicate with the server. Although multiple clients won't work - I believe this is because a client reserves a socket while connected? Is there a simple way to add multiple…
-1
votes
2 answers

Loading From File Error In Java?

I have to implement Object Files for a java project, however I am having trouble when it comes to loading the file (Save is all OK) public static void loadStudentList() { boolean endOfFile = false; try { // create a FileInputStream…
Matthew Cassar
  • 203
  • 2
  • 3
  • 12
-1
votes
1 answer

send a serializable object over socket

I have a strange problem to send a serializable object that I have created over socket. In fact if I run the server and the client in the same machine it works well but if the server and the client are in different machines the readen object in the…
-1
votes
1 answer

server connections

I'm doing my own server in Java. I need to do one socket connection and receive a lot of object from client. I did it, it works, but I don`t know if this is the best(fastest) solution. Here is example of my code: try { serverSocket=new…
user1247373
  • 163
  • 1
  • 11
-2
votes
1 answer

ObjectInputStream gives IOException when readObject() is called

I'm trying to copy a file with .dat extension from a certain directory decided by the user into the project directory. When I try to read the saved object selected by the user, the program always gives IOException. File f = new…
Freder
  • 11
  • 3
-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
-3
votes
2 answers

cannot receive data on client side which is running on different machine than server (Java socket programming)

Okay so I have made a project called Uno Game server. The server and client program both run fine when executed on same machine. But when they are executed on different machines, I cannot receive data on the client side. The program gets stuck…
1 2 3
39
40