public synchronized int read ( ) throws IOException { if ( bytesUntilNextMetadata > 0 ) { bytesUntilNextMetadata -- ; return super . read ( ) ; } else if ( bytesUntilNextMetadata == 0 ) { readMetadata ( ) ; bytesUntilNextMetadata = metaint - 1 ; // -1 because we read byte on next line return super . read ( ) ; } else { return super . read ( ) ; } }
Reads and returns a single byte . If the next byte is a metadata block then that block is read stripped and parsed before reading and returning the first byte after the metadata block .