private static void addId(final StringBuilder buf,final byte[] id){
  buf.append("\\Q");
  boolean backslash=false;
  for (  final byte b : id) {
    buf.append((char)(b & 0xFF));
    if (b == 'E' && backslash) {
      buf.append("\\\\E\\Q");
    }
 else {
      backslash=b == '\\';
    }
  }
  buf.append("\\E");
}

private static void addId ( final StringBuilder buf , final byte [ ] id ) { buf . append ( "\\Q" ) ; boolean backslash = false ; for ( final byte b : id ) { buf . append ( ( char ) ( b & 0xFF ) ) ; if ( b == 'E' && backslash ) { buf . append ( "\\\\E\\Q" ) ; } else { backslash = b == '\\' ; } } buf . append ( "\\E" ) ; }
appends the given id to the given buffer , followed by " \ \ e " . [ steal it from opentsdb , thanks opentsdb : ) https : / / github . com / opentsdb / opentsdb / blob / master / src / core / tsdbquery . java ]
