private void writeGUIDValue(ByteBuffer buffer,Object value) throws IOException {
  Matcher m=GUID_PATTERN.matcher(toCharSequence(value));
  if (!m.matches()) {
    throw new IOException(withErrorContext("Invalid GUID: " + value));
  }
  ByteBuffer origBuffer=null;
  byte[] tmpBuf=null;
  if (buffer.order() != ByteOrder.BIG_ENDIAN) {
    origBuffer=buffer;
    tmpBuf=new byte[16];
    buffer=ByteBuffer.wrap(tmpBuf);
  }
  ByteUtil.writeHexString(buffer,m.group(1));
  ByteUtil.writeHexString(buffer,m.group(2));
  ByteUtil.writeHexString(buffer,m.group(3));
  ByteUtil.writeHexString(buffer,m.group(4));
  ByteUtil.writeHexString(buffer,m.group(5));
  if (tmpBuf != null) {
    ByteUtil.swap4Bytes(tmpBuf,0);
    ByteUtil.swap2Bytes(tmpBuf,4);
    ByteUtil.swap2Bytes(tmpBuf,6);
    origBuffer.put(tmpBuf);
  }
}

private void writeGUIDValue ( ByteBuffer buffer , Object value ) throws IOException { Matcher m = GUID_PATTERN . matcher ( toCharSequence ( value ) ) ; if ( ! m . matches ( ) ) { throw new IOException ( withErrorContext ( "Invalid GUID: " + value ) ) ; } ByteBuffer origBuffer = null ; byte [ ] tmpBuf = null ; if ( buffer . order ( ) != ByteOrder . BIG_ENDIAN ) { origBuffer = buffer ; tmpBuf = new byte [ 16 ] ; buffer = ByteBuffer . wrap ( tmpBuf ) ; } ByteUtil . writeHexString ( buffer , m . group ( 1 ) ) ; ByteUtil . writeHexString ( buffer , m . group ( 2 ) ) ; ByteUtil . writeHexString ( buffer , m . group ( 3 ) ) ; ByteUtil . writeHexString ( buffer , m . group ( 4 ) ) ; ByteUtil . writeHexString ( buffer , m . group ( 5 ) ) ; if ( tmpBuf != null ) { ByteUtil . swap4Bytes ( tmpBuf , 0 ) ; ByteUtil . swap2Bytes ( tmpBuf , 4 ) ; ByteUtil . swap2Bytes ( tmpBuf , 6 ) ; origBuffer . put ( tmpBuf ) ; } }
writes a guid value .
