com.vividsolutions.jts.io
public class WKBWriter extends java.lang.Object
Geometry
into Well-Known Binary format.
Supports use of an OutStream
, which allows easy use
with arbitary byte stream sinks.
The WKB format is specified in the OGC Simple Features for SQL specification. This implementation supports the extended WKB standard for representing 3-dimensional coordinates. The presence of 3D coordinates is signified by setting the high bit of the wkbType word.
Empty Points cannot be represented in WKB; an
IllegalArgumentException
will be thrown if one is
written. The WKB specification does not support representing LinearRing
s;
they will be written as LineString
s.
This class is designed to support reuse of a single instance to read multiple geometries. This class is not thread-safe; each thread should create its own instance.
WKBReader
Constructor and Description |
---|
WKBWriter()
Creates a writer that writes
Geometry s with
output dimension = 2 and BIG_ENDIAN byte order |
WKBWriter(int outputDimension)
Creates a writer that writes
Geometry s with
the given dimension (2 or 3) for output coordinates
and BIG_ENDIAN byte order. |
WKBWriter(int outputDimension,
int byteOrder)
Creates a writer that writes
Geometry s with
the given dimension (2 or 3) for output coordinates
and byte order
If the input geometry has a small coordinate dimension,
coordinates will be padded with NULL_ORDINATE . |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToHex(byte[] bytes)
Deprecated.
|
static java.lang.String |
toHex(byte[] bytes)
Converts a byte array to a hexadecimal string.
|
byte[] |
write(Geometry geom)
Writes a
Geometry into a byte array. |
void |
write(Geometry geom,
OutStream os)
|
public WKBWriter()
Geometry
s with
output dimension = 2 and BIG_ENDIAN byte orderpublic WKBWriter(int outputDimension)
Geometry
s with
the given dimension (2 or 3) for output coordinates
and BIG_ENDIAN
byte order.
If the input geometry has a small coordinate dimension,
coordinates will be padded with NULL_ORDINATE
.outputDimension
- the coordinate dimension to output (2 or 3)public WKBWriter(int outputDimension, int byteOrder)
Geometry
s with
the given dimension (2 or 3) for output coordinates
and byte order
If the input geometry has a small coordinate dimension,
coordinates will be padded with NULL_ORDINATE
.outputDimension
- the coordinate dimension to output (2 or 3)byteOrder
- the byte ordering to usepublic static java.lang.String bytesToHex(byte[] bytes)
bytes
- public static java.lang.String toHex(byte[] bytes)
bytes
- a byte arraypublic byte[] write(Geometry geom)
Geometry
into a byte array.geom
- the geometry to write