public static void appendLengthAndMask(ByteBuffer buffer,int length,byte mask[]){
  if (mask != null) {
    appendLength(buffer,length,true);
    buffer.put(mask);
  }
 else {
    appendLength(buffer,length,false);
  }
}

public static void appendLengthAndMask ( ByteBuffer buffer , int length , byte mask [ ] ) { if ( mask != null ) { appendLength ( buffer , length , true ) ; buffer . put ( mask ) ; } else { appendLength ( buffer , length , false ) ; } }
appends the length and mask to the buffer
