0

My code is:

try {             
                        // De-serialize it!
                        ByteArrayInputStream fis = new 
                        ByteArrayInputStream(serFile);
                        GZIPInputStream gzis = new GZIPInputStream(fis);
                        ObjectInputStream ois = new ObjectInputStream(gzis);                
                        reptDef = (AdHocReportDefinition)ois.readObject();                  


                    }

I am getting this error on ObjectInputStream while reading the seralized file.

 java.io.EOFException: Unexpected end of ZLIB input stream
        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:234)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
        at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:101)
        at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2307)
        at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2320)
        at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2791)
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:795)
        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:293)
  • It is not because I am getting a serialized file from Database and it is not writing the object before reading it . which makes the answer irrelevant. – Diwas Subedi Jun 21 '17 at 19:26
  • That duplicate suggest that the data wasn't written correctly: or in other words: your data wasn't written completely, so there is no way to read it back correctly. – Mark Rotteveel Jun 21 '17 at 19:42
  • thanks I got that the written data was false – Diwas Subedi Jun 21 '17 at 21:11

0 Answers0