public class MessageChunksWriter extends Object
| Modifier and Type | Field and Description |
|---|---|
static byte |
DELIMITER_CONTENT |
static int |
DELIMITER_LENGTH |
static DynamicOptionClient |
doc |
static int |
SIZE_OF_MESSAGE_LENGTH |
| Constructor and Description |
|---|
MessageChunksWriter(OutputStream output) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
Flush and release resources.
|
static DynamicOptionClient |
doc() |
void |
flush(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
Force the writing of the collection to the output stream.
|
int |
getAppendedInChunk()
The number of entries appended in the current chunk.
|
long |
getCurrentChunkStartOffset()
Return the offset of the beginning of the current chunk (in byte, from position zero in the file).
|
long |
getTotalBytesWritten()
Returns the number of bytes written to output.
|
long |
getTotalEntriesWritten()
Returns the number of entries written to output.
|
void |
printStats(PrintStream out)
Print statistics.
|
void |
printStats(PrintWriter writer)
Print statistics.
|
void |
setNumEntriesPerChunk(int numEntriesPerChunk)
Specify the maximum number of entries to store in any given chunk.
|
void |
setParser(ProtobuffCollectionHandler protobuffCollectionHandler) |
void |
writeAsNeeded(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
Write the entry collection as needed to the output stream.
|
long |
writeAsNeeded(com.google.protobuf.GeneratedMessage.Builder collectionBuilder,
int multiplicity)
Write the entry collection as needed to the output stream.
|
public static final byte DELIMITER_CONTENT
public static final int DELIMITER_LENGTH
public static final int SIZE_OF_MESSAGE_LENGTH
public static final DynamicOptionClient doc
public MessageChunksWriter(OutputStream output)
public static DynamicOptionClient doc()
public void setNumEntriesPerChunk(int numEntriesPerChunk)
numEntriesPerChunk - maximum number of entries per chunk.public void writeAsNeeded(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
collectionBuilder - The builder prepared with the growing collection of entries.IOException - if there was an error writing the entriespublic long writeAsNeeded(com.google.protobuf.GeneratedMessage.Builder collectionBuilder,
int multiplicity)
collectionBuilder - The builder prepared with the growing collection of entries.multiplicity - Indicates how many logical entries are included in the message that
was just appended.IOException - if there was an error writing the entriespublic long getCurrentChunkStartOffset()
public void flush(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
collectionBuilder - The builder prepared with the growing collection of entries.public void close(com.google.protobuf.GeneratedMessage.Builder collectionBuilder)
throws IOException
collectionBuilder - The builder prepared with the growing collection of entries.IOException - if there is a problem closing the stream unerlying streampublic long getTotalEntriesWritten()
public long getTotalBytesWritten()
public void printStats(PrintWriter writer)
writer - the writer used to print the statisticspublic void printStats(PrintStream out)
out - Where to print.public int getAppendedInChunk()
public void setParser(ProtobuffCollectionHandler protobuffCollectionHandler)
Copyright © 2017 Campagne Laboratory. All rights reserved.