The AFPInputStream throws an AfpFormatException("premature end of file.") if the first or second byte of the structured field length is 0xFF.
If the first byte is a 0xFF the file is "broken" of course, but the second byte can be 0xFF... In my test case I have a file where a record begins with 5A1FFF
The fix is quite simple... In AFPInputStream please have a look at the method read. Just replace return header[(int) offset]; with return header[(int) offset] & 0xff;
The
AFPInputStream
throws anAfpFormatException("premature end of file.")
if the first or second byte of the structured field length is 0xFF.If the first byte is a 0xFF the file is "broken" of course, but the second byte can be 0xFF... In my test case I have a file where a record begins with
5A1FFF
The fix is quite simple... In
AFPInputStream
please have a look at the methodread
. Just replacereturn header[(int) offset];
withreturn header[(int) offset] & 0xff;
bye, Michael