public int encode(byte[] data,int off,int length,OutputStream out) throws IOException {
  for (int i=off; i < (off + length); i++) {
    int v=data[i] & 0xff;
    out.write(encodingTable[(v >>> 4)]);
    out.write(encodingTable[v & 0xf]);
  }
  return length * 2;
}

public int encode ( byte [ ] data , int off , int length , OutputStream out ) throws IOException { for ( int i = off ; i < ( off + length ) ; i ++ ) { int v = data [ i ] & 0xff ; out . write ( encodingTable [ ( v > > > 4 ) ] ) ; out . write ( encodingTable [ v & 0xf ] ) ; } return length * 2 ; }
encode the input data producing a hex output stream .
