public abstract class BufferedIndexOutput extends IndexOutput
IndexOutput
.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size in bytes (16384).
|
Constructor and Description |
---|
BufferedIndexOutput()
Creates a new
BufferedIndexOutput with the default buffer size
(16384 bytes see DEFAULT_BUFFER_SIZE ) |
BufferedIndexOutput(int bufferSize)
Creates a new
BufferedIndexOutput with the given buffer size. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this stream to further operations.
|
void |
flush()
Forces any buffered output to be written.
|
protected abstract void |
flushBuffer(byte[] b,
int offset,
int len)
Expert: implements buffer write.
|
int |
getBufferSize()
Returns size of the used output buffer in bytes.
|
long |
getFilePointer()
Returns the current position in this file, where the next write will
occur.
|
abstract long |
length()
The number of bytes in the file.
|
void |
seek(long pos)
Sets 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.
|
setLength
copyBytes, writeBytes, writeInt, writeLong, writeShort, writeString, writeStringSet, writeStringStringMap, writeVInt, writeVLong
public static final int DEFAULT_BUFFER_SIZE
public BufferedIndexOutput()
BufferedIndexOutput
with the default buffer size
(16384 bytes see DEFAULT_BUFFER_SIZE
)public BufferedIndexOutput(int bufferSize)
BufferedIndexOutput
with the given buffer size.bufferSize
- the buffer size in bytes used to buffer writes internally.IllegalArgumentException
- if the given buffer size is less or equal to 0public 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()
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)
public void flush() throws IOException
IndexOutput
flush
in class IndexOutput
IOException
protected abstract void flushBuffer(byte[] b, int offset, int len) throws IOException
b
- the bytes to writeoffset
- the offset in the byte arraylen
- the number of bytes to writeIOException
public void close() throws IOException
IndexOutput
close
in interface Closeable
close
in class IndexOutput
IOException
public long getFilePointer()
IndexOutput
getFilePointer
in class IndexOutput
IndexOutput.seek(long)
public void seek(long pos) throws IOException
IndexOutput
seek
in class IndexOutput
IOException
IndexOutput.getFilePointer()
public abstract long length() throws IOException
IndexOutput
length
in class IndexOutput
IOException
public final int getBufferSize()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.