Class BinaryCodec

  • Direct Known Subclasses:
    JtsBinaryCodec

    public class BinaryCodec
    extends java.lang.Object
    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.

    • Method Detail

      • readShape

        public Shape readShape​(java.io.DataInput dataInput)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeShape

        public void writeShape​(java.io.DataOutput dataOutput,
                               Shape s)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readShapeByTypeIfSupported

        protected Shape readShapeByTypeIfSupported​(java.io.DataInput dataInput,
                                                   byte type)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • writeShapeByTypeIfSupported

        protected boolean writeShapeByTypeIfSupported​(java.io.DataOutput dataOutput,
                                                      Shape s)
                                               throws java.io.IOException
        Note: writes the type byte even if not supported
        Throws:
        java.io.IOException
      • writeShapeByTypeIfSupported

        protected boolean writeShapeByTypeIfSupported​(java.io.DataOutput dataOutput,
                                                      Shape s,
                                                      byte type)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • typeForShape

        protected byte typeForShape​(Shape s)
      • readDim

        protected double readDim​(java.io.DataInput dataInput)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeDim

        protected void writeDim​(java.io.DataOutput dataOutput,
                                double v)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readPoint

        public Point readPoint​(java.io.DataInput dataInput)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writePoint

        public void writePoint​(java.io.DataOutput dataOutput,
                               Point pt)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readRect

        public Rectangle readRect​(java.io.DataInput dataInput)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeRect

        public void writeRect​(java.io.DataOutput dataOutput,
                              Rectangle r)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readCircle

        public Circle readCircle​(java.io.DataInput dataInput)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCircle

        public void writeCircle​(java.io.DataOutput dataOutput,
                                Circle c)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • readCollection

        public ShapeCollection readCollection​(java.io.DataInput dataInput)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCollection

        public void writeCollection​(java.io.DataOutput dataOutput,
                                    ShapeCollection col)
                             throws java.io.IOException
        Throws:
        java.io.IOException