png - Skip bytes in ByteArray Java -
my app reads png-like file (in byte) , stores bytes bytearray. method use :
public static byte[] read(file file) throws ioexception { byte []buffer = new byte[(int) file.length()]; inputstream ios = null; try { ios = new fileinputstream(file); if ( ios.read(buffer) == -1 ) { throw new ioexception("eof reached while trying read whole file"); } } { try { if ( ios != null ) ios.close(); } catch ( ioexception e) { } } return buffer; } after that, want extract patterns of bytearray.
follows pattern of png file :
4 bytes length + 4 bytes types + data (optional) + crc , repeats scheme.
i want while : reading length + type. if i'm not interested of type, want skip chunk. i'm struggling because can't find skip method bytearray[].
does have idea of how proceed ?
have tried use bytearrayinputstream http://docs.oracle.com/javase/7/docs/api/java/io/bytearrayinputstream.html? there skip method
Comments
Post a Comment