public abstract class ReusedBufferedIndexOutput extends IndexOutput
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
static int |
BUFFER_SIZE |
Constructor and Description |
---|
ReusedBufferedIndexOutput(String resourceDescription,
String name) |
ReusedBufferedIndexOutput(String resourceDescription,
String name,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this stream to further operations.
|
protected abstract void |
closeInternal() |
protected void |
flushBufferToCache()
Write the buffered bytes to cache
|
protected long |
getBufferStart() |
long |
getFilePointer()
Returns the current position in this file, where the next write will
occur.
|
void |
writeByte(byte b)
Writes a single byte.
|
void |
writeBytes(byte[] b,
int offset,
int length)
Writes an array of bytes.
|
protected abstract void |
writeInternal(byte[] b,
int offset,
int length)
Expert: implements buffer flushing to cache.
|
getChecksum, getName, toString
copyBytes, writeBytes, writeInt, writeLong, writeMapOfStrings, writeSetOfStrings, writeShort, writeString, writeStringSet, writeStringStringMap, writeVInt, writeVLong, writeZInt, writeZLong
public static final int BUFFER_SIZE
protected byte[] buffer
public ReusedBufferedIndexOutput(String resourceDescription, String name)
public ReusedBufferedIndexOutput(String resourceDescription, String name, int bufferSize)
protected long getBufferStart()
protected void flushBufferToCache() throws IOException
IOException
protected abstract void closeInternal() throws IOException
IOException
public void close() throws IOException
IndexOutput
close
in interface Closeable
close
in interface AutoCloseable
close
in class IndexOutput
IOException
public long getFilePointer()
IndexOutput
getFilePointer
in class IndexOutput
public void writeByte(byte b) throws IOException
DataOutput
The most primitive data type is an eight-bit byte. Files are accessed as sequences of bytes. All other data types are defined as sequences of bytes, so file formats are byte-order independent.
writeByte
in class DataOutput
IOException
DataInput.readByte()
protected abstract void writeInternal(byte[] b, int offset, int length) throws IOException
b
- the array of bytes to writeoffset
- the offset in the array of bytes to writelength
- the number of bytes to writeIOException
public void writeBytes(byte[] b, int offset, int length) throws IOException
DataOutput
writeBytes
in class DataOutput
b
- the bytes to writeoffset
- the offset in the byte arraylength
- the number of bytes to writeIOException
DataInput.readBytes(byte[],int,int)