public void write(Geometry g, OutputStream out) throws IOException { write(g, new OutputStreamOutStream(out)); out.flush(); }
private static byte[] toWKB(Geometry g) { try { WKBWriter w = new WKBWriter(); // write the geometry ByteArrayOutputStream bytes = new ByteArrayOutputStream(); w.write(g, new OutputStreamOutStream(bytes)); // supplement it with the srid int srid = g.getSRID(); bytes.write((byte) (srid >>> 24)); bytes.write((byte) (srid >> 16 & 0xff)); bytes.write((byte) (srid >> 8 & 0xff)); bytes.write((byte) (srid & 0xff)); return bytes.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } //
public void write(Geometry g, OutputStream out) throws IOException { write(g, new OutputStreamOutStream(out)); out.flush(); }
/** * deprecated {@link #gToWKB(Geometry)} */ private static byte[] toWKB( Geometry g ) { try { WKBWriter w = new WKBWriter(); //write the geometry ByteArrayOutputStream bytes = new ByteArrayOutputStream(); w.write( g , new OutputStreamOutStream( bytes ) ); //supplement it with the srid int srid = g.getSRID(); bytes.write( (byte)(srid >>> 24) ); bytes.write( (byte)(srid >> 16 & 0xff) ); bytes.write( (byte)(srid >> 8 & 0xff) ); bytes.write( (byte)(srid & 0xff) ); return bytes.toByteArray(); } catch (IOException e) { throw new RuntimeException( e ); } }
/** * deprecated {@link #gToWKB(Geometry)} */ private static byte[] toWKB( Geometry g ) { try { WKBWriter w = new WKBWriter(); //write the geometry ByteArrayOutputStream bytes = new ByteArrayOutputStream(); w.write( g , new OutputStreamOutStream( bytes ) ); //supplement it with the srid int srid = g.getSRID(); bytes.write( (byte)(srid >>> 24) ); bytes.write( (byte)(srid >> 16 & 0xff) ); bytes.write( (byte)(srid >> 8 & 0xff) ); bytes.write( (byte)(srid & 0xff) ); return bytes.toByteArray(); } catch (IOException e) { throw new RuntimeException( e ); } }
wkbwriter().write( g , new OutputStreamOutStream( bytes ) ); byte[] b = bytes.toByteArray();
wkbwriter().write( g , new OutputStreamOutStream( bytes ) ); byte[] b = bytes.toByteArray();