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
2
votes
1 answer

Unable to write and save XLSM file with Apache POI

I have an existing XLSM file, in which I try to write data with use of Apache POI. String File = GlobalVariables.XLSM; try { Workbook workbook; workbook = new XSSFWorkbook(OPCPackage.open(GlobalVariables.XLSM)); Sheet sheet =…
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
2
votes
1 answer

Trinidad/ADF Faces, file upload, EOFException

I use JSF 2.3 (Mojarra 2.3.3), Trinidad (2.2.1) and its file upload component (tr:inputFile) in a web.xml-version 3.1 on a Tomcat 8.5 server. I get following exception and no valid uploaded file (i.e. the "value"-binded bean attribute remains…
Thies
  • 686
  • 6
  • 17
2
votes
1 answer

EOFException initializing an ObjectInputStream

I am new and I only know a little of english. Well my problem is that I have to do a Multithreading server and a Client class to communicate a lot of clients to one server. I am saving my clients in a hashmap and after adding to the hashmap I am…
2
votes
1 answer

java.io.EOFException - ActiveMQ messaging broker

Here is the trace which is from startup.log (tomcat) java.io.EOFException at java.io.DataInputStream.readInt(DataInputStream.java:392) at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:267) at…
Satscreate
  • 495
  • 12
  • 38
2
votes
1 answer

PySpark throws java.io.EOFException when reading big files with boto3

I'm using boto3 to read files from S3, this have shown to be much faster than sc.textFile(...). These files are between 300MB and 1GB approx. The process goes like: data = sc.parallelize(list_of_files, numSlices=n_partitions) \ …
hmourit
  • 81
  • 1
  • 2
  • 5
2
votes
1 answer

Java: Hazelcast : java.io.EOFException: Cannot read 4 bytes

For my web application ,I have 2 instance that I have defined in hazelcast xml. When I start one server, it started properly but when I start second server i am getting following error : SEVERE: [192.168.1.32]:5701 [dev] [3.5] java.io.EOFException:…
2
votes
1 answer

Android: HttpURLConnection throwing EOFException

I am creating connection with server inside AsyncTask. I am using HttpURLConnection. I am sending the data in url. Below is the code of doInBackground() method of AsyncTask. I tried retrying to send the data to server but the issue was not fixed. I…
Nitesh Kumar
  • 5,370
  • 5
  • 37
  • 54
2
votes
2 answers

Random errors while transferring over socket

Ok so I have a block of code that is supposed to send multiple files over a socket. The way I am doing this in a for loop I am opening a socket -> transferring a file -> closing socket then repeat for other files. The said code it below: for (int…
2
votes
1 answer

EOFexception in Java when reading objectinputstream

I want to read multiple objects (my own class Term) that I have output to a .dat file, but I always get a nullPointException or EOFException. ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(masterFile)); Object o =…
user276712
  • 862
  • 4
  • 12
  • 20
2
votes
2 answers

Why is my ObjectInputStream throwing an EOFException?

I am writing a chat room code and each message is sent back and forth between client and server constantly. I have made all the messages into serialized objects and am using them to pass the information back and forth. Unfortunately this has led to…
2
votes
4 answers

java.io.EOFException using ksoap2 lib libcore.io.Streams.readAsciiLine(Streams.java:203)

03-26 14:12:19.045: E/Webservices(2863): java.io.EOFException 03-26 14:12:19.045: E/Webservices(2863): at libcore.io.Streams.readAsciiLine(Streams.java:203) 03-26 14:12:19.045: E/Webservices(2863): at…
Manikandan
  • 844
  • 15
  • 31
2
votes
2 answers

eofexception while setting up stream

I'm trying to send a string to the servlet from java program and retrieve the same string with some padding. Here's the code i'm working on and the problem is java.io.EOFException is being thrown at the establishment of inputstream in java…
jagadeesh
  • 91
  • 1
  • 9
2
votes
2 answers

Where can I find the list of all Java (SE 7) standard library classes which have methods which will throw an EOFException?

I'm trying to track down the source of an EOFException in some client/server code, but many of the classes used only have methods which say that they throw an IOException, not specifically an EOFException. Normally I'd just look at the stack trace…
2rs2ts
  • 10,662
  • 10
  • 51
  • 95
2
votes
1 answer

EOFException when posting with facebook sdk 3.0 on android

I am Posting to groups on facebook but i have encounterd with 2 exceptions: could not construct body exception EOFException I have tried many solutions but with no success. including this: System.setProperty("http.keepAlive", "false"); thanx…
Yakir Yehuda
  • 650
  • 7
  • 23
2
votes
2 answers

Unable to connect RMI client to host, unmarshalexception caused by eofexception

I have the following files open in netbeans. server: package server; import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; import java.sql.*; public class Server implements ServerInterface { private Connection con; …
Ashley Stewart
  • 161
  • 1
  • 3
  • 12
1 2
3
14 15