Class ShpWriter
java.lang.Object
ch.so.agi.gretl.internal.shapefile.core.ShpWriter
- All Implemented Interfaces:
AutoCloseable
Low-level writer for the
.shp main file.
This writer is byte-level only: it writes the 100-byte header and individual record blocks
(8-byte big-endian record header followed by the little-endian content of an EncodedShape). Geometry-to-bytes encoding lives in ShpGeometryEncoder so that the
core package stays free of JTS encoding logic.
The FileChannel is owned by ShapefileDatasetWriter; close() therefore
does not close the channel.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidwriteHeader(ShapefileHeader header) Writes (or patches) the 100-byte file header at the start of the file.voidwriteRecord(int recordNumber, EncodedShape encoded) Appends a single record at the current channel position.
-
Constructor Details
-
ShpWriter
-
-
Method Details
-
shapeType
-
writeHeader
Writes (or patches) the 100-byte file header at the start of the file.- Throws:
IOExceptionShapefileMappingException
-
writeRecord
public void writeRecord(int recordNumber, EncodedShape encoded) throws IOException, ShapefileMappingException Appends a single record at the current channel position.The record header (record number and content length in 16-bit words) is big-endian; the content is the little-endian
EncodedShape.content()buffer produced by the encoder.- Throws:
IOExceptionShapefileMappingException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-