public class BinaryCodec extends Object
Immutable and thread-safe.
Modifier and Type | Field and Description |
---|---|
protected SpatialContext |
ctx |
protected static byte |
TYPE_CIRCLE |
protected static byte |
TYPE_COLL |
protected static byte |
TYPE_GEOM |
protected static byte |
TYPE_POINT |
protected static byte |
TYPE_RECT |
Constructor and Description |
---|
BinaryCodec(SpatialContext ctx,
SpatialContextFactory factory) |
Modifier and Type | Method and Description |
---|---|
Circle |
readCircle(DataInput dataInput) |
ShapeCollection |
readCollection(DataInput dataInput) |
protected double |
readDim(DataInput dataInput) |
Point |
readPoint(DataInput dataInput) |
Rectangle |
readRect(DataInput dataInput) |
Shape |
readShape(DataInput dataInput) |
protected Shape |
readShapeByTypeIfSupported(DataInput dataInput,
byte type) |
protected byte |
typeForShape(Shape s) |
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 supported
|
protected boolean |
writeShapeByTypeIfSupported(DataOutput dataOutput,
Shape s,
byte type) |
protected static final byte TYPE_POINT
protected static final byte TYPE_RECT
protected static final byte TYPE_CIRCLE
protected static final byte TYPE_COLL
protected static final byte TYPE_GEOM
protected final SpatialContext ctx
public BinaryCodec(SpatialContext ctx, SpatialContextFactory factory)
public Shape readShape(DataInput dataInput) throws IOException
IOException
public void writeShape(DataOutput dataOutput, Shape s) throws IOException
IOException
protected Shape readShapeByTypeIfSupported(DataInput dataInput, byte type) throws IOException
IOException
protected boolean writeShapeByTypeIfSupported(DataOutput dataOutput, Shape s) throws IOException
IOException
protected boolean writeShapeByTypeIfSupported(DataOutput dataOutput, Shape s, byte type) throws IOException
IOException
protected byte typeForShape(Shape s)
protected double readDim(DataInput dataInput) throws IOException
IOException
protected void writeDim(DataOutput dataOutput, double v) throws IOException
IOException
public Point readPoint(DataInput dataInput) throws IOException
IOException
public void writePoint(DataOutput dataOutput, Point pt) throws IOException
IOException
public Rectangle readRect(DataInput dataInput) throws IOException
IOException
public void writeRect(DataOutput dataOutput, Rectangle r) throws IOException
IOException
public Circle readCircle(DataInput dataInput) throws IOException
IOException
public void writeCircle(DataOutput dataOutput, Circle c) throws IOException
IOException
public ShapeCollection readCollection(DataInput dataInput) throws IOException
IOException
public void writeCollection(DataOutput dataOutput, ShapeCollection col) throws IOException
IOException
Copyright © 2020 LocationTech. All rights reserved.