Package crosby.binary
Class BinarySerializer
- java.lang.Object
-
- crosby.binary.BinarySerializer
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class BinarySerializer extends Object implements Closeable, Flushable
Generic serializer common code Serialize a set of blobs and process them. Subclasses implement handlers for different API's (osmosis, mkgmap, splitter, etc.) All data is converted into PrimGroupWriterInterface objects, which are then ordered to process their data at the appropriate time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceBinarySerializer.PrimGroupWriterInterfaceInterface used to write a group of primitives.
-
Field Summary
Fields Modifier and Type Field Description protected intbatch_limitprotected intbatch_sizeHow many primitives have been seen in this batchprotected intdate_granularityprotected intgranularityprotected List<BinarySerializer.PrimGroupWriterInterface>groupsprotected intMIN_DENSEprotected booleanomit_metadataprotected BlockOutputStreamoutputprotected inttotal_entities
-
Constructor Summary
Constructors Constructor Description BinarySerializer(BlockOutputStream output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconfigBatchLimit(int batch_limit)Configure the maximum number of entities in a batchvoidconfigGranularity(int granularity)Set the granularity (precision of lat/lon, measured in unites of nanodegrees.voidconfigOmit(boolean omit_metadata)Set whether metadata is to be omittedvoidflush()StringTablegetStringTable()intmapDegrees(double degrees)Convert from a degrees represented as a double into the serialized offset.longmapRawDegrees(double degrees)Convert from a degrees represented as a double into the serialized offset in nanodegrees..voidprocessBatch()
-
-
-
Field Detail
-
MIN_DENSE
protected final int MIN_DENSE
- See Also:
- Constant Field Values
-
batch_limit
protected int batch_limit
-
granularity
protected int granularity
-
date_granularity
protected int date_granularity
-
omit_metadata
protected boolean omit_metadata
-
batch_size
protected int batch_size
How many primitives have been seen in this batch
-
total_entities
protected int total_entities
-
groups
protected List<BinarySerializer.PrimGroupWriterInterface> groups
-
output
protected BlockOutputStream output
-
-
Constructor Detail
-
BinarySerializer
public BinarySerializer(BlockOutputStream output)
-
-
Method Detail
-
configGranularity
public void configGranularity(int granularity)
Set the granularity (precision of lat/lon, measured in unites of nanodegrees.
-
configOmit
public void configOmit(boolean omit_metadata)
Set whether metadata is to be omitted
-
configBatchLimit
public void configBatchLimit(int batch_limit)
Configure the maximum number of entities in a batch
-
getStringTable
public StringTable getStringTable()
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
processBatch
public void processBatch()
-
mapRawDegrees
public long mapRawDegrees(double degrees)
Convert from a degrees represented as a double into the serialized offset in nanodegrees..
-
mapDegrees
public int mapDegrees(double degrees)
Convert from a degrees represented as a double into the serialized offset.
-
-