public class PlainArchiveBuffer extends AbstractArchiveBuffer
This can only be used for testing or if you have at hand a filesystem based compression support.
This is also the base for all non-streaming buffers.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
createRoot |
protected ByteArrayOutputStream |
outputStream |
destinations, filename, maxWrites, minWrites, pool| Constructor and Description |
|---|
PlainArchiveBuffer(int minWrites,
int maxWrites,
List<org.thales.punch.libraries.objectstorage.tuples.ArchiveDevice> destinations,
org.thales.punch.libraries.record.client.encoder.api.IRecordEncoder<Map<String,Object>> encoder,
org.thales.punch.libraries.record.client.encoder.api.IRecordEncoder.RecordFormat format,
boolean createRoot)
Ctor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(List<String> successAddresses)
Close this archive buffer.
|
protected byte[] |
getByteArray()
Get final byte array
|
String |
getDigest()
Return the digest of written bytes
|
long |
getSize()
Return the size, compressed if compression enabled, of written bytes
|
long |
getUncompressedSize()
Return the size, uncompressed if compression enabled, of written bytes
|
void |
put(Map<String,Object> record)
Add a single item in the archive buffer.
|
protected void |
putBytes(byte[] bytes)
Write bytes to correct buffer
|
protected void |
writeToDestination(org.thales.punch.libraries.objectstorage.tuples.ArchiveDevice destination,
byte[] bb)
Write byte array to provided destination.
|
exit, getBatchOutputPath, handleDeviceFailure, prepareprotected final ByteArrayOutputStream outputStream
protected final boolean createRoot
public PlainArchiveBuffer(int minWrites,
int maxWrites,
List<org.thales.punch.libraries.objectstorage.tuples.ArchiveDevice> destinations,
org.thales.punch.libraries.record.client.encoder.api.IRecordEncoder<Map<String,Object>> encoder,
org.thales.punch.libraries.record.client.encoder.api.IRecordEncoder.RecordFormat format,
boolean createRoot)
createRoot - true to create the root directoryprotected byte[] getByteArray()
protected void writeToDestination(org.thales.punch.libraries.objectstorage.tuples.ArchiveDevice destination,
byte[] bb)
throws IOException
destination - targetbb - content to writeIOException - Unable to writepublic void put(Map<String,Object> record)
IArchiveBufferrecord - the input recordprotected void putBytes(byte[] bytes)
throws IOException
bytes - content to writeIOException - Unable to writepublic long getSize()
IArchiveBufferpublic long getUncompressedSize()
IArchiveBufferpublic void close(List<String> successAddresses)
IArchiveBuffersuccessAddresses - in case of success the returned list of where the writes were successful.public String getDigest()
IArchiveBufferCopyright © 2023. All rights reserved.