public class SequentialWriter
extends java.io.OutputStream
Modifier and Type | Class and Description |
---|---|
protected static class |
SequentialWriter.BufferedFileWriterMark
Class to hold a mark to the position of the file
|
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
protected long |
bufferOffset |
protected long |
current |
protected boolean |
isDirty |
protected java.io.RandomAccessFile |
out |
java.io.DataOutputStream |
stream |
protected boolean |
syncNeeded |
protected int |
validBufferBytes |
Constructor and Description |
---|
SequentialWriter(java.io.File file,
int bufferSize,
boolean skipIOCache) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
byte[] |
digest()
Return the digest associated to this file or null if no digest was
created.
|
void |
flush()
If buffer is dirty, flush it's contents to the operating system.
|
protected void |
flushData()
Override this method instead of overriding flush()
|
protected void |
flushInternal() |
long |
getFilePointer() |
long |
getOnDiskFilePointer()
Return the current file pointer of the underlying on-disk file.
|
java.lang.String |
getPath() |
long |
length() |
FileMark |
mark() |
static SequentialWriter |
open(java.io.File file) |
static SequentialWriter |
open(java.io.File file,
boolean skipIOCache) |
static SequentialWriter |
open(java.io.File file,
int bufferSize,
boolean skipIOCache) |
protected void |
reBuffer() |
void |
resetAndTruncate(FileMark mark) |
protected void |
resetBuffer() |
void |
setComputeDigest()
Turn on digest computation on this writer.
|
void |
sync()
Synchronize file contents with disk.
|
protected void |
syncDataOnlyInternal() |
protected void |
syncInternal() |
void |
truncate(long toSize) |
void |
write(byte[] buffer) |
void |
write(byte[] data,
int offset,
int length) |
void |
write(int value) |
protected boolean isDirty
protected boolean syncNeeded
protected byte[] buffer
protected long current
protected long bufferOffset
protected int validBufferBytes
protected final java.io.RandomAccessFile out
public final java.io.DataOutputStream stream
public SequentialWriter(java.io.File file, int bufferSize, boolean skipIOCache)
public static SequentialWriter open(java.io.File file)
public static SequentialWriter open(java.io.File file, boolean skipIOCache)
public static SequentialWriter open(java.io.File file, int bufferSize, boolean skipIOCache)
public void write(int value) throws java.nio.channels.ClosedChannelException
write
in class java.io.OutputStream
java.nio.channels.ClosedChannelException
public void write(byte[] buffer) throws java.nio.channels.ClosedChannelException
write
in class java.io.OutputStream
java.nio.channels.ClosedChannelException
public void write(byte[] data, int offset, int length) throws java.nio.channels.ClosedChannelException
write
in class java.io.OutputStream
java.nio.channels.ClosedChannelException
public void sync()
protected void syncDataOnlyInternal()
protected void syncInternal()
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
protected void flushInternal()
protected void flushData()
FSWriteError
- on any I/O error.public long getFilePointer()
public long getOnDiskFilePointer()
public long length()
public java.lang.String getPath()
protected void reBuffer()
protected void resetBuffer()
public FileMark mark()
public void resetAndTruncate(FileMark mark)
public void truncate(long toSize)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
public void setComputeDigest()
public byte[] digest()
Copyright © 2013 The Apache Software Foundation