624 questions
1
vote
2
answers
107
views
Deserializing Java object streams with different serial version IDs
I am trying to load data from Java object streams from another application. Since I do not have access to the source code of that application, I used jdeserialize to extract the class definitions from ...
0
votes
0
answers
108
views
How to repair a file with java.io.EOFException
I'm not sure what happened when saving a file, but now when I try to load it I get java.io.EOFException. All of the code is in try/catch blocks but there was no error when saving the file.
Opening the ...
0
votes
1
answer
67
views
Continuous Socket connection, ObjectInputStream EOF on second request
Java 21 Sockets allowing for multiple connections using ObjectInputStream and ObjectOutputStream produce EOF on second request
I have a Client side, a (middleman) Bridge Server and an Inventory ...
0
votes
0
answers
75
views
Java Serialization / Deserialization Duplicate Object Problem
I'm writing a large scale program in java where I keep track of the Nodes with different data structures.
Specifically, one of my Node type have 2 left & right pointers for 2 different Binary ...
0
votes
0
answers
105
views
ObjectInputStream constructor gives StreamCorruptedException: invalid stream header: EFBFBDEF
I am trying to use an ObjectOutputStream and an ObjectInputStream to store multiple BookLibrary objects in an ArrayList, but whenever I attempt to read in the data from the text file ("data.txt&...
0
votes
1
answer
66
views
How to realize the ObjectInputStream::read function's return value
When using Java socket to transfer a file, I set byte[] BUFFER = new byte[1024 * 8], and using objectInputStream.read(BUFFER, 0, BUFFER.length) to receive file stream, but the return value of ...
0
votes
1
answer
74
views
How to determine the boundary when reading with ois.readObject()
If the sender uses ois.writeObject to continuously send two objects of the same class to the receiver, and the receiver uses oos.readObject to read, is it possible for the receiver to treat the two ...
0
votes
0
answers
42
views
How to use ObjectInputStream to find a class instance in a list of instances
I am trying to create an instance of the class Account and it cannot have the same handle as other accounts, which is checked using a for loop which compares the handle passed a parameter to the ...
1
vote
0
answers
559
views
Gradle missing inputs properties
After update from Gradle 6 to 7.x i cannot solve and find the cause of missing properties. For fields File and File Collection that being annotated @Input
`Reason: A property of type 'File' annotated ...
1
vote
1
answer
45
views
Long is set to null when transmited over ObjectStream from server to client
I have an abstract Entity
public class Entity<ID> {
private ID id;
public ID getId() {
return id;
}
public void setId(ID id) {
this.id = id;
}
}
And a User ...
0
votes
0
answers
658
views
class java.lang.Boolean cannot be cast to class java.util.ArrayList
I'm trying to read an ArrayList of objects from a BinaryI/O but I keep getting the error "class java.lang.Boolean cannot be cast to class java.util.ArrayList (java.lang.Boolean and java.util....
0
votes
1
answer
59
views
Objects not read completely when reading from a File in Java
I'm saving objects from two array lists to a file and if I restart the application I have called a read method at the startup which will read the data from the file and add them to the array lists
But ...
0
votes
0
answers
217
views
add files to root and access it within Android Studio Project
in java you could add the file within the project so you could use it on any device, i.e if the file is "data.dat" in java I could put the file in the project root and write this line
try (...
0
votes
0
answers
149
views
Read file content into Arraylist using ObjectInputStream
I am a beginner in java and practicing IO stream and Serialization .In below problem unable to read all data into a Arraylist and print it. by using the ObjectOutputStream insert the content by user ...
0
votes
1
answer
69
views
StreamCorruptedException reading a resource file only in a Spring Boot application
On a Spring Boot application (2.3.3), I have a dependency to a module developed by my company. From a service I'm calling a method from this dependency which needs a file loaded from resources (src/...
1
vote
1
answer
97
views
Cannot recieve objects that contains other objects with ObjectInputStream in Java
I try to use ObjectInputStream and ObjectOutputStream in my Java project but the object I want to send on the network contains other objects than String, int, boolean etc... so it does not work when I ...
1
vote
1
answer
143
views
Why is deserialized object's size different from serialized object's size?
I'm saving some Java objects in files. I seralize them that way :
Class Timestamp.java:
public class Timestamp implements java.io.Serializable {
private static final long serialVersionUID = 1L;
...
0
votes
1
answer
651
views
Why doesn't the ObjectOutputStream write the variables in the file as intended? [duplicate]
I am learning Java and I'm trying to get a programme to write the attributes of one class instance of another into a .txt file, like a phonebook for instance. I have a class User :
package idpack;
...
0
votes
0
answers
896
views
Reading Java Stream Objects from input stream
I have a problem with java.lang.Object stream. InputStream actually is a real Object[]. readObject method reads only one object. How can I read stream objects correctly? Sample code is below.
...
0
votes
0
answers
83
views
Server doesn't receive client Object java
i have a server that work if change String with clients. Now,i want to use Object instead of String but the server doesn't receive anything and get stugged before the sout like the client doesn't sand ...
0
votes
1
answer
115
views
Java socket getting only NUL characters after writing byte array
I'm trying to send files in chunks from a client to server via byte arrays. I'm using ObjectInputStream. The write works and the filesize matches but when I open the file, I only get a blank textfile(...
0
votes
1
answer
553
views
Looping through a ObjectInputStream in one method and print entire file in the main method, but having problems with EOF not working or erroring
So I have a working ObjectOutputStream in a method that I start by calling the method in main. I need to then read the file it created and print out all 5 objects in it. Right now I'm only printing ...
1
vote
1
answer
750
views
unexpected behavior from custom ObjectInputStream when reading object with LocalDate field
i'm using the example from this repo https://github.com/kojenov/serial/tree/master/3-4.%20upload, which is presenting a method for specifying a way to protect form unsafe deserialization in Java by ...
1
vote
1
answer
443
views
ObjectInputStream Error: StreamCorruptedException
I am making an instant messaging application where I set up a TLS connection between two phones where one acts as a Server and the other as the Client. When trying to send a message I get this ...
0
votes
2
answers
548
views
ObjectInputStream not reading full file after appending data
I am writing a small program that inserts customer details in ArrayList and write it in file.
The problem is with ObjectOutputStream I was able to append data in file with turning FileOutputStream(&...