11package net .sharksystem .asap .engine ;
22
33import net .sharksystem .asap .ASAPChannel ;
4+ import net .sharksystem .asap .ASAPException ;
45import net .sharksystem .asap .ASAPHop ;
6+ import net .sharksystem .asap .utils .ASAPSerialization ;
57import net .sharksystem .asap .utils .Helper ;
68
79import java .io .*;
@@ -300,10 +302,13 @@ private boolean readMetaData(File metaFile) throws IOException {
300302 DataInputStream dis = new DataInputStream (new FileInputStream (metaFile ));
301303
302304 try {
305+ // do it as first element - shure how many bytes we read..
306+ this .hopList = ASAPSerialization .readASAPHopList (dis );
307+
303308 this .uri = dis .readUTF ();
304309 this .setExtraByString (dis .readUTF ());
305310 }
306- catch (EOFException eof ) {
311+ catch (EOFException | ASAPException eof ) {
307312 // file empty
308313 return false ;
309314 }
@@ -316,10 +321,9 @@ private boolean readMetaData(File metaFile) throws IOException {
316321 String offsetList = dis .readUTF ();
317322 this .messageStartOffsets = this .messageOffsetString2List (offsetList );
318323 }
319- catch (IOException ioe ) {
324+ catch (IOException e ) {
320325 // no more data - ok
321- }
322- finally {
326+ } finally {
323327 dis .close ();
324328 }
325329
@@ -329,6 +333,9 @@ private boolean readMetaData(File metaFile) throws IOException {
329333 private void writeMetaData (File metaFile ) throws IOException {
330334 // write data to metafile
331335 DataOutputStream dos = new DataOutputStream (new FileOutputStream (metaFile ));
336+
337+ // do it as first element - shure how many bytes we read..
338+ ASAPSerialization .writeASAPHopList (this .hopList , dos );
332339
333340 dos .writeUTF (this .uri );
334341 dos .writeUTF (this .getExtraAsString ());
0 commit comments