public void writeBytes ( byte value , int len ) throws IOException { if ( len > buf . length - pos ) { //not enough space remaining byte [ ] arr = new byte [ len ] ; Arrays . fill ( arr , value ) ; write ( arr , 0 , len ) ; return ; } for ( int i = pos ; i < pos + len ; i ++ ) { buf [ i ] = value ; } pos += len ; }
Write byte value len times into buffer . flush buffer if too small .