Package crosby.binary
Class BinarySerializer
- java.lang.Object
-
- crosby.binary.BinarySerializer
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class BinarySerializer extends java.lang.Object implements java.io.Closeable, java.io.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 interface
BinarySerializer.PrimGroupWriterInterface
Interface used to write a group of primitives.
-
Field Summary
Fields Modifier and Type Field Description protected int
batch_limit
protected int
batch_size
How many primitives have been seen in this batchprotected int
date_granularity
(package private) long
debug_bytes
protected int
granularity
protected java.util.List<BinarySerializer.PrimGroupWriterInterface>
groups
protected int
MIN_DENSE
protected boolean
omit_metadata
protected BlockOutputStream
output
private StringTable
stringtable
protected int
total_entities
-
Constructor Summary
Constructors Constructor Description BinarySerializer(BlockOutputStream output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configBatchLimit(int batch_limit)
Configure the maximum number of entities in a batchvoid
configGranularity(int granularity)
Set the granularity (precision of lat/lon, measured in unites of nanodegrees.void
configOmit(boolean omit_metadata)
Set whether metadata is to be omittedvoid
flush()
StringTable
getStringTable()
int
mapDegrees(double degrees)
Convert from a degrees represented as a double into the serialized offset.long
mapRawDegrees(double degrees)
Convert from a degrees represented as a double into the serialized offset in nanodegrees..void
processBatch()
-
-
-
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
-
stringtable
private final StringTable stringtable
-
groups
protected java.util.List<BinarySerializer.PrimGroupWriterInterface> groups
-
output
protected BlockOutputStream output
-
debug_bytes
long debug_bytes
-
-
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 java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.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.
-
-