public static void insertEmptyData(ByteBuffer buffer,int len){
  byte[] buf=buffer.array();
  int pos=buffer.position();
  int limit=buffer.limit();
  System.arraycopy(buf,pos,buf,pos + len,limit - pos);
  Arrays.fill(buf,pos,pos + len,(byte)0);
  buffer.limit(limit + len);
}

public static void insertEmptyData ( ByteBuffer buffer , int len ) { byte [ ] buf = buffer . array ( ) ; int pos = buffer . position ( ) ; int limit = buffer . limit ( ) ; System . arraycopy ( buf , pos , buf , pos + len , limit - pos ) ; Arrays . fill ( buf , pos , pos + len , ( byte ) 0 ) ; buffer . limit ( limit + len ) ; }
inserts empty data of the given length at the current position of the given buffer ( moving existing data forward the given length ) . the limit of the buffer is adjusted by the given length . the buffer is expecting to have the required capacity available .
