private void ensureAvail ( int n ) { if ( pos + n >= buf . length ) { int newSize = Math . max ( pos + n , buf . length * 2 ) ; buf = Arrays . copyOf ( buf , newSize ) ; } }
make sure there will be enought space in buffer to write N bytes