Package org.locationtech.spatial4j.io
Class BinaryCodec
java.lang.Object
org.locationtech.spatial4j.io.BinaryCodec
- Direct Known Subclasses:
JtsBinaryCodec
A binary shape format. It is not designed to be a published standard, unlike Well Known
Binary (WKB). The initial release is simple but it could get more optimized to use fewer bytes or
to write & read pre-computed index structures.
Immutable and thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SpatialContext
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreadCircle
(DataInput dataInput) readCollection
(DataInput dataInput) protected double
protected Shape
readShapeByTypeIfSupported
(DataInput dataInput, byte type) protected byte
void
writeCircle
(DataOutput dataOutput, Circle c) void
writeCollection
(DataOutput dataOutput, ShapeCollection col) protected void
writeDim
(DataOutput dataOutput, double v) void
writePoint
(DataOutput dataOutput, Point pt) void
writeRect
(DataOutput dataOutput, Rectangle r) void
writeShape
(DataOutput dataOutput, Shape s) protected boolean
writeShapeByTypeIfSupported
(DataOutput dataOutput, Shape s) Note: writes the type byte even if not supportedprotected boolean
writeShapeByTypeIfSupported
(DataOutput dataOutput, Shape s, byte type)
-
Field Details
-
TYPE_POINT
protected static final byte TYPE_POINT- See Also:
-
TYPE_RECT
protected static final byte TYPE_RECT- See Also:
-
TYPE_CIRCLE
protected static final byte TYPE_CIRCLE- See Also:
-
TYPE_COLL
protected static final byte TYPE_COLL- See Also:
-
TYPE_GEOM
protected static final byte TYPE_GEOM- See Also:
-
ctx
-
-
Constructor Details
-
BinaryCodec
-
-
Method Details
-
readShape
- Throws:
IOException
-
writeShape
- Throws:
IOException
-
readShapeByTypeIfSupported
- Throws:
IOException
-
writeShapeByTypeIfSupported
Note: writes the type byte even if not supported- Throws:
IOException
-
writeShapeByTypeIfSupported
protected boolean writeShapeByTypeIfSupported(DataOutput dataOutput, Shape s, byte type) throws IOException - Throws:
IOException
-
typeForShape
-
readDim
- Throws:
IOException
-
writeDim
- Throws:
IOException
-
readPoint
- Throws:
IOException
-
writePoint
- Throws:
IOException
-
readRect
- Throws:
IOException
-
writeRect
- Throws:
IOException
-
readCircle
- Throws:
IOException
-
writeCircle
- Throws:
IOException
-
readCollection
- Throws:
IOException
-
writeCollection
- Throws:
IOException
-