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

Files not being written to device

I have been trying a hundred different methods to solve my problem, but for some reason they simple won't work. I'm trying to make a quick and dirty way, for my application to be persistent. It basically got a lot of objects it needs to save when…
Martin
  • 157
  • 1
  • 11
0
votes
1 answer

ObjectInputStream won't initialize when using BufferedOutputStreams

I am trying to send objects across a socket for a game, but they take a long time to send and can cause the game to hang. I want to use BufferedOutputStreams and BufferedInputStreams to send the data, but my ObjectInputStream won't initialize on the…
0
votes
1 answer

How can I speed up the passing of objects between two sockets using an ObjectOutputStream and the writeObject() and reset() methods?

I am writing an application (a multiplayer game) where objects need to be passed from one instance of the application to another (and very quickly) via a server. I am using ObjectOutputStreams and ObjectInputStreams obtained through the sockets to…
0
votes
1 answer

Passing an ObjectOutputStream to another class

I am developing a GUI program to use in a client/server system that will save data in a Vector. I have an ObjectOutputStream and ObjectInputStream that is created when I make the connection, however I am not sure how to pass it into the new class…
0
votes
3 answers

Unable to read serializable class from .dat file

I try to write a keyholder, and I want to write the passwords to a .dat file using ObjectOutputStream, and then read them using ObjectInputStream. This is my code for writing the objects: public void toFile() { try { …
EscalatedQuickly
  • 400
  • 4
  • 22
0
votes
2 answers

ObjectOutputStream Advice

The goal with my program is to have it save when closed, and reloaded when opened. I have a driver (which contains all of the graphics) and I want it to create and save a file. I've seen numerous tutorials on the internet, but what they fail to…
flyinghigh
  • 235
  • 3
  • 11
0
votes
1 answer

Android App crashes on startup while reading objects from java.lang.NullPointerException

I am working on my first Android app. It was working fine until I decided to add a functionality to save and load objects and settings on OnCreate and onRestart. After that the app crashes on startup. Here is the setSettings that I call from…
0
votes
1 answer

ObjectInputStream failing to read

I have an ObjectOutputStream and an ObjectInputStream. I try to send ints and objects through them. Now I manage to send through and read up to a point and I don't know why it stops there. Here is the point: Reader: while (true) { start…
Trixmix
  • 81
  • 9
0
votes
1 answer

Java, when calling readObject() on an ObjectOutputStream it is only returning one value

I'm writing a server / client game. My client sends a message to the server and the server is supposed to distribute that message to all other clients connected to the server. The problem I'm having is that when I call ois.readObject() (where ois is…
Rovert Renchirk
  • 97
  • 1
  • 11
0
votes
1 answer

Java - binary file I/O with array-list

I'm a beginner on java and I'm having problem using binary file input and output of an array list. I'm trying to store the data on the array list on a file and then use it to display it in the console. Here is some of my code, it runs but displays…
JProg
  • 189
  • 1
  • 9
  • 15
0
votes
1 answer

How to serialize the absolute minimum amount of data in a Serializable implementation?

I'm new to Java.io.Serializable, so my apologies if this is a completely newb question. What I'd like to do is implement readObject() and writeObject() such that the absolute minimum of data is serialized. I'd basically like to only write a few…
Carl Veazey
  • 18,392
  • 8
  • 66
  • 81
0
votes
1 answer

passing string read from text file to writeObject() in java?

I am a beginner in JAVA. This is my first question in this forum.I am developing a hex editor tool for a project. As a part of it, I have to make a small application which should open a text file and read contents of it and display it in an editor…
kirankar
  • 39
  • 1
  • 6
-1
votes
0 answers

Reading Objects from file results in class java.lang.String cannot be cast to class java.io.ObjectStreamClass Exception

A brief description of a program I am building. The program has 3 classes, a user class, a port class, and a vehicle class. The port class contains an Id property of String type and Arraylist property that contains all onsite vehicles. The Vehicle…
-1
votes
1 answer

How to Serialize and Deserialize multiple objects in Java during runtime

I am creating a Login Form and Sign up Form using JFrames. The problem is every time when the user presses the Sign up button the user details should be serialized and added to the "users.ser" file. And if the user presses the Login button it has to…
-1
votes
1 answer

Windows 10 - ObjectOutputStream can't find relative paths because current working directory is System32

When I call method System.out.print(new File("").getAbsolutePath()) from main I get the project workspace C:\Users\darkr\Desktop\NuovoWorkSpace\ProjectName. When it gets called by our save() method, which serializes what we need, suddenly the…