org.apache.cassandra.io.util
Class SequentialWriter
java.lang.Object
java.io.OutputStream
org.apache.cassandra.io.util.SequentialWriter
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
- Direct Known Subclasses:
- CompressedSequentialWriter
public class SequentialWriter
- extends java.io.OutputStream
Constructor Summary |
SequentialWriter(java.io.File file,
int bufferSize,
boolean skipIOCache)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
isDirty
protected boolean isDirty
syncNeeded
protected boolean syncNeeded
buffer
protected byte[] buffer
current
protected long current
bufferOffset
protected long bufferOffset
validBufferBytes
protected int validBufferBytes
out
protected final java.io.RandomAccessFile out
stream
public final java.io.DataOutputStream stream
SequentialWriter
public SequentialWriter(java.io.File file,
int bufferSize,
boolean skipIOCache)
throws java.io.IOException
- Throws:
java.io.IOException
open
public static SequentialWriter open(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
open
public static SequentialWriter open(java.io.File file,
boolean skipIOCache)
throws java.io.IOException
- Throws:
java.io.IOException
open
public static SequentialWriter open(java.io.File file,
int bufferSize,
boolean skipIOCache)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(int value)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] buffer)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] data,
int offset,
int length)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
sync
public void sync()
throws java.io.IOException
- Synchronize file contents with disk.
- Throws:
java.io.IOException
- on any I/O error.
syncInternal
protected void syncInternal()
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- If buffer is dirty, flush it's contents to the operating system. Does not imply fsync().
Currently, for implementation reasons, this also invalidates the buffer.
- Specified by:
flush
in interface java.io.Flushable
- Overrides:
flush
in class java.io.OutputStream
- Throws:
java.io.IOException
- on any I/O error.
flushInternal
protected void flushInternal()
throws java.io.IOException
- Throws:
java.io.IOException
flushData
protected void flushData()
throws java.io.IOException
- Override this method instead of overriding flush()
- Throws:
java.io.IOException
- on any I/O error.
getFilePointer
public long getFilePointer()
length
public long length()
throws java.io.IOException
- Throws:
java.io.IOException
getPath
public java.lang.String getPath()
reBuffer
protected void reBuffer()
throws java.io.IOException
- Throws:
java.io.IOException
resetBuffer
protected void resetBuffer()
mark
public FileMark mark()
resetAndTruncate
public void resetAndTruncate(FileMark mark)
throws java.io.IOException
- Throws:
java.io.IOException
truncate
public void truncate(long toSize)
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.OutputStream
- Throws:
java.io.IOException
Copyright © 2011 The Apache Software Foundation