com.partnersoft.formats.shapefile
Class ShapeByteWriter

java.lang.Object
  extended by com.partnersoft.formats.shapefile.ShapeByteWriter

public class ShapeByteWriter
extends java.lang.Object

Writes the low-level values used in the shapefile format.

This is a wrapper around DynamicByteArray that translates to the values used in shapes (generally little-endian 4-byte ints and 8-byte floats) and in SDE binary (generally a compressed integer format that is then scaled and offset to generate a coordinate value).

It also includes some convenience functions for standard structures such as points and boxes (bounds).

Copyright 2007-2008 Partner Software, Inc.

Version:
$Id: ShapeByteWriter.java 1701 2009-01-13 22:11:48Z paul $
Author:
Paul Reavis

Constructor Summary
ShapeByteWriter(DynamicByteArray bytes)
           
 
Method Summary
 DynamicByteArray getBytes()
          Returns the underlying DynamicByteArray.
 void writeBounds(XyBounds bounds)
          Write an XyBounds as four doubles.
 void writeDouble(double value)
          Write a Double, which is stored as an 8-byte little-endian float.
 void writeDoubleArray(double[] array)
          Writes an array of doubles in the same manner as writeDouble().
 void writeInteger(int value)
          Write an Integer, which is stored as a 4-byte signed little-endian int.
 void writeIntegerArray(int[] array)
          Writes an array of integers in the same manner as writeInteger().
 void writePackedInteger(long value)
          Write a packed integer value.
 void writePoint(XyPoint point)
          Write an XyPoint as two Doubles.
 void writePointZ(XyzPoint point)
          Write an XyzPoint as two Doubles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeByteWriter

public ShapeByteWriter(DynamicByteArray bytes)
Method Detail

writeInteger

public void writeInteger(int value)
Write an Integer, which is stored as a 4-byte signed little-endian int.


writeIntegerArray

public void writeIntegerArray(int[] array)
Writes an array of integers in the same manner as writeInteger().


writeDouble

public void writeDouble(double value)
Write a Double, which is stored as an 8-byte little-endian float.


writeDoubleArray

public void writeDoubleArray(double[] array)
Writes an array of doubles in the same manner as writeDouble().


writePackedInteger

public void writePackedInteger(long value)
Write a packed integer value. This is the format used for coordinates in Arc/SDE. Note that generally these are not absolute values, but are instead meant to be added to the previous value as a relative offset. The result is then scaled and offset using spatial reference parameters.

The higher precision allowed by Arc/SDE 9.2 means that this requires an 8-byte input value.


writePointZ

public void writePointZ(XyzPoint point)
Write an XyzPoint as two Doubles.


writePoint

public void writePoint(XyPoint point)
Write an XyPoint as two Doubles.


writeBounds

public void writeBounds(XyBounds bounds)
Write an XyBounds as four doubles.


getBytes

public DynamicByteArray getBytes()
Returns the underlying DynamicByteArray.