Questions tagged [eofexception]

An exception that occurs when reading from a stream or file, and indicates that the end of the stream has been reached. For example, you had expected to read 4 bytes from a stream with DataInputStream.readFully(), or an object with ObjectInputStream.readObject(), but end of stream was encountered instead.

An exception that occurs when reading from a stream or file, and indicates that the end of the stream has been reached. For example, you had expected to read 4 bytes from a stream with DataInputStream.readFully(), or an object with ObjectInputStream.readObject(), but end of stream was encountered instead.

Even though the exception is named EOF for 'end of file', it is possible to get this exception when processing any data stream. The exception can occur as a result of many different actions, such as:

  1. Reading data from a socket connection that has already been closed by the peer and all prior pending data has already been read.
  2. Reading data from an empty file.

When reading from a stream, you should usually detect and handle this exception, as well as other stream-related exceptions such as timeouts, by wrapping your reads in a try-catch block. This will allow you to catch exceptions such as this, and perform an alternate operation, such as alerting the user of the error, or ending the logical connection at this end.

214 questions
0
votes
1 answer

WebSocketListener EOF Exception

I'm trying to get response of an audio byte array from WebSocketApi by sending it through Okhttp3-(WebSocketListener). But am getting EOFException in onFailure() of WebSocketListener while sending audio byte array. My code: //Establishing connection…
Anila
  • 27
  • 12
0
votes
1 answer

JAVA objectinputstream cant drop out from the loop

Here is the code I have: ObjectInputStream ois = null; UserRegistration UR = new UserRegistration(); Scanner pause = new Scanner(System.in); Admin go = new Admin(); try { //ItemEntry book = new ItemEntry(); …
Huat Lee
  • 27
  • 2
0
votes
1 answer

PubSub Kafka Connect node connection end of file exception

While running PubSub Kafka connect using the command: .\bin\windows\connect-standalone.bat .\etc\kafka\WorkerConfig.properties .\etc\kafka\configSink.properties .\etc\kafka\configSource.properties I get this error: Sending metadata request…
0
votes
0 answers

spring boot embedded tomcat logs debug level EOFException & ClosedChannelException when handling request

environment: spring boot react root log level: debug(not default level info), so the spring boot embedded tomcat debug message will be logged when running. when web browser requests be handled, some debug exception messages about tomcat always are…
yuchao
  • 63
  • 3
0
votes
1 answer

Java registering a provider throws EOFException

I am using iText to convert html to pdf and when I try to register a fontProvider I get EOFException, here is the relevant code: XMLWorkerFontProvider fontProvider =new…
Itsik Mauyhas
  • 3,824
  • 14
  • 69
  • 114
0
votes
1 answer

Java ObjectInputStream throws EOFException with bigger object

I have this method to deserialize: public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); …
0
votes
1 answer

EOFException when reading a custom class with ObjectOutputStream

I'm encountering the following EOFException: java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2903) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1502) at…
0
votes
1 answer

Kafka ssl Producer EOFException while Producer.send from Cloud Foundry

In Cloud Foundry I am able to produce message to non ssl url ("kafkaURL:9092"). But it does NOT work for ssl url ("kafkaURL:9093"). Kafka server version 0.10.0.1 and client version 0.10.0.0. Here are the properties I…
vinny
  • 1
  • 2
0
votes
2 answers

GroovyPagesException: Error applying layout

I got stuck with that problem. I found a lot of similar questions, but they have differed yet from my situation (maybe I missed something?). So, here is a stacktrace from production server: 2016-11-10 04:28:59,148 [qtp1265210847-22] ERROR…
0
votes
1 answer

Writing an object to the file

What I am trying to do is writing a HashMap to a file. The code below correctly when run at once. However when i try to run just writing the object to the file and try to just run reading the written object to file individually it throws the…
Krish
  • 159
  • 3
  • 14
0
votes
1 answer

Reading from binary file returns -1 without throwing EOFException

I am trying to read one byte integers from a file. The integers are read correctly however the process keeps reading the integer '-1' without throwing an EOF exception. This is how I write the integers into the file. I read 4 byte integers from…
MattSt
  • 1,024
  • 2
  • 16
  • 35
0
votes
1 answer

java.io.EOFException when reading weka trained model file

I'm trying to load my weka trained model file to generate a prediction. But I get a error of java.io.eofexception when trying to do this. I'm sure this is got to do with my model file being not correctly formed. But I have used weka tool to create…
CraZyDroiD
  • 6,622
  • 30
  • 95
  • 182
0
votes
1 answer

Jsoup userAgent on Android - What does it mean?

I'm doing some HTML parsing using Jsoup in Android and I encountered some weird stuff(for me). Some sites work fine using the simple Jsoup.connect(String).get() method. But in some other sites I ALWAYS get an EOFException. So i search and tackled…
God
  • 1,238
  • 2
  • 18
  • 45
0
votes
1 answer

EOFExcepton reading UDP

I am receiving an EOFException when the receiver of a UDP packet attempts to read it. Instances that are charged with reading and decoding UDP packets are called Engager objects. They contain a socket which is created in the Engager's constructor,…
user1941660
0
votes
1 answer

Cannot get data from file

Using JFileChooser to save file and everything works perfect: private void saveFileDialog(){ fileChooser = new JFileChooser(System.getProperty("employees.dat")); disableTextField(fileChooser.getComponents()); …
Alex
  • 57
  • 1
  • 7