code: public byte[] write( Geometry geom ) {
          try {
              byteArrayOS.reset();
              writeSpatialiteGeometry(geom, byteArrayOutStream);
          } catch (IOException ex) {
              throw new RuntimeException("Unexpected IO exception: " + ex.getMessage());
          }
          return byteArrayOS.toByteArray();
      }
docs: Writes a {@link Geometry} into a byte array.
  
  @param geom the geometry to write
  @return the byte array containing the WKB