Class EncodeTag

java.lang.Object
org.apache.sedona.common.S2Geography.EncodeTag

public class EncodeTag extends Object
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 Details

    • FLAG_EMPTY

      public static final byte FLAG_EMPTY
      set if geography has zero shapes
      See Also:
    • FLAG_COMPACT

      public static final byte FLAG_COMPACT
      set if using COMPACT coding; if clear, we’ll treat as FAST
      See Also:
  • Constructor Details

    • EncodeTag

      public EncodeTag()
    • EncodeTag

      public EncodeTag(EncodeOptions opts)
  • Method Details

    • encode

      public void encode(com.esotericsoftware.kryo.io.Output out) throws IOException
      Write exactly 4 bytes: [kind|flags|coveringSize|reserved].
      Throws:
      IOException
    • decode

      public static EncodeTag decode(com.esotericsoftware.kryo.io.Input in) throws IOException
      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

      public void skipCovering(com.esotericsoftware.kryo.io.UnsafeInput in) throws IOException
      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

      public Geography.GeographyKind getKind()
    • setKind

      public void setKind(Geography.GeographyKind kind)
    • 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()