Class EncodeTag
java.lang.Object
org.apache.sedona.common.S2Geography.EncodeTag
A 4 byte prefix for encoded geographies. Builds a 5-byte header (EncodeTag) containing 1 byte:
kind 1 byte: flags 1 byte: coveringSize 1 byte: reserved (must be 0)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteset if using COMPACT coding; if clear, we’ll treat as FASTstatic final byteset if geography has zero shapes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EncodeTagdecode(com.esotericsoftware.kryo.io.Input in) Reads exactly 4 bytes (in the same order) from the stream.voiddecodeCovering(com.esotericsoftware.kryo.io.UnsafeInput in, List<com.google.common.geometry.S2CellId> cellIds) Read coveringSize many cell-ids and add them to cellIds.voidencode(com.esotericsoftware.kryo.io.Output out) Write exactly 4 bytes: [kind|flags|coveringSize|reserved].bytebytegetFlags()getKind()booleanbooleanisEmpty()booleanisFast()voidsetCompact(boolean compact) choose COMPACT (true) or FAST (false)voidsetCoveringSize(byte size) voidsetEmpty(boolean empty) mark or unmark the EMPTY flagvoidsetFlags(byte flags) voidvoidskipCovering(com.esotericsoftware.kryo.io.UnsafeInput in) Skip over coveringSize many cell-ids in the stream.voidvalidate()Ensure we didn’t accidentally write a non-zero reserved byte.
-
Field Details
-
FLAG_EMPTY
public static final byte FLAG_EMPTYset if geography has zero shapes- See Also:
-
FLAG_COMPACT
public static final byte FLAG_COMPACTset if using COMPACT coding; if clear, we’ll treat as FAST- See Also:
-
-
Constructor Details
-
EncodeTag
public EncodeTag() -
EncodeTag
-
-
Method Details
-
encode
Write exactly 4 bytes: [kind|flags|coveringSize|reserved].- Throws:
IOException
-
decode
Reads exactly 4 bytes (in the same order) from the stream.- Throws:
IOException
-
decodeCovering
public void decodeCovering(com.esotericsoftware.kryo.io.UnsafeInput in, List<com.google.common.geometry.S2CellId> cellIds) throws IOException Read coveringSize many cell-ids and add them to cellIds.- Throws:
IOException
-
skipCovering
Skip over coveringSize many cell-ids in the stream.- Throws:
IOException
-
validate
public void validate()Ensure we didn’t accidentally write a non-zero reserved byte. -
getKind
-
setKind
-
getFlags
public byte getFlags() -
setFlags
public void setFlags(byte flags) -
getCoveringSize
public byte getCoveringSize() -
setCoveringSize
public void setCoveringSize(byte size) -
setEmpty
public void setEmpty(boolean empty) mark or unmark the EMPTY flag -
setCompact
public void setCompact(boolean compact) choose COMPACT (true) or FAST (false) -
isEmpty
public boolean isEmpty() -
isCompact
public boolean isCompact() -
isFast
public boolean isFast()
-