/**
  * Encodes a <code>Geometry</code> into a WKB representation using the specified byte-order.
  *
  * @param geom The <code>Geometry</code> to be encoded as WKB.
  * @param wbo The WKB byte order, either {@link ByteOrder#XDR XDR} or {@link ByteOrder#NDR NDR}
  * @return A buffer of bytes that contains the WKB-encoded <code>Geometry</code>.
  */
 public ByteBuffer encode(Geometry geom, ByteOrder wbo) {
   ByteBuffer output = ByteBuffer.allocate(calculateSize(geom, true));
   if (wbo != null) {
     output.setWKBByteOrder(wbo);
   }
   writeGeometry(geom, output);
   output.rewind();
   return output;
 }