public class SequentialWriter extends BufferedDataOutputStreamPlus implements Transactional
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SequentialWriter.BufferedFileWriterMark
Class to hold a mark to the position of the file
|
protected class |
SequentialWriter.TransactionalProxy |
Transactional.AbstractTransactional| Modifier and Type | Field and Description |
|---|---|
protected long |
bufferOffset |
protected Descriptor |
descriptor |
protected java.nio.channels.FileChannel |
fchannel |
protected long |
lastFlushOffset |
protected java.lang.Runnable |
runPostFlush |
buffer, strictFlushingchannel| Constructor and Description |
|---|
SequentialWriter(java.io.File file,
int bufferSize,
BufferType bufferType) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Throwable |
abort(java.lang.Throwable accumulate) |
void |
close() |
java.lang.Throwable |
commit(java.lang.Throwable accumulate) |
protected long |
current() |
protected void |
doFlush(int count) |
void |
finish() |
SequentialWriter |
finishOnClose() |
protected void |
flushData()
Override this method instead of overriding flush()
|
long |
getLastFlushOffset() |
long |
getOnDiskFilePointer()
Returns the current file pointer of the underlying on-disk file.
|
java.lang.String |
getPath() |
boolean |
hasPosition()
If the implementation supports providing a position, this method returns
true, otherwise false. |
boolean |
isOpen() |
long |
length() |
DataPosition |
mark() |
static SequentialWriter |
open(java.io.File file)
Open a heap-based, non-compressed SequentialWriter
|
static ChecksummedSequentialWriter |
open(java.io.File file,
java.io.File crcPath) |
static CompressedSequentialWriter |
open(java.lang.String dataFilePath,
java.lang.String offsetsPath,
CompressionParams parameters,
MetadataCollector sstableMetadataCollector) |
long |
position()
Returns the current position of the underlying target like a file-pointer
or the position withing a buffer.
|
void |
prepareToCommit() |
void |
resetAndTruncate(DataPosition mark)
Drops all buffered data that's past the limits of our new file mark + buffer capacity, or syncs and truncates
the underlying file to the marked position
|
protected void |
resetBuffer() |
SequentialWriter |
setDescriptor(Descriptor descriptor) |
void |
setPostFlushListener(java.lang.Runnable runPostFlush) |
void |
sync()
Synchronize file contents with disk.
|
protected void |
syncDataOnlyInternal() |
protected void |
syncInternal() |
void |
truncate(long toSize) |
protected SequentialWriter.TransactionalProxy |
txnProxy() |
applyToChannel, flush, order, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUnsignedVInt, writeUTF, writeVIntnewDefaultChannel, retrieveTemporaryBufferprotected long bufferOffset
protected final java.nio.channels.FileChannel fchannel
protected long lastFlushOffset
protected java.lang.Runnable runPostFlush
protected Descriptor descriptor
public SequentialWriter(java.io.File file,
int bufferSize,
BufferType bufferType)
public static SequentialWriter open(java.io.File file)
public static ChecksummedSequentialWriter open(java.io.File file, java.io.File crcPath)
public static CompressedSequentialWriter open(java.lang.String dataFilePath, java.lang.String offsetsPath, CompressionParams parameters, MetadataCollector sstableMetadataCollector)
public SequentialWriter finishOnClose()
public void sync()
protected void syncDataOnlyInternal()
protected void syncInternal()
protected void doFlush(int count)
doFlush in class BufferedDataOutputStreamPluspublic void setPostFlushListener(java.lang.Runnable runPostFlush)
protected void flushData()
FSWriteError - on any I/O error.public boolean hasPosition()
DataOutputPlustrue, otherwise false.hasPosition in interface DataOutputPluspublic long position()
DataOutputPlusDataOutputPlus.hasPosition().position in interface DataOutputPluspublic long getOnDiskFilePointer()
public long length()
public java.lang.String getPath()
protected void resetBuffer()
protected long current()
public DataPosition mark()
public void resetAndTruncate(DataPosition mark)
public long getLastFlushOffset()
public void truncate(long toSize)
public boolean isOpen()
public SequentialWriter setDescriptor(Descriptor descriptor)
public final void prepareToCommit()
prepareToCommit in interface Transactionalpublic final java.lang.Throwable commit(java.lang.Throwable accumulate)
commit in interface Transactionalpublic final java.lang.Throwable abort(java.lang.Throwable accumulate)
abort in interface Transactionalpublic final void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface Transactionalclose in class BufferedDataOutputStreamPluspublic final void finish()
protected SequentialWriter.TransactionalProxy txnProxy()
Copyright © 2016 The Apache Software Foundation