protected static String drainInboundMessageBuffer(StringBuilder builder,int index){
  String result=builder.substring(0,index);
  builder.delete(0,index);
  return result;
}

protected static String drainInboundMessageBuffer ( StringBuilder builder , int index ) { String result = builder . substring ( 0 , index ) ; builder . delete ( 0 , index ) ; return result ; }
removes characters 0 - index from inboundmessagebuffer and returns the string removed .
