public final class ByteBuffersIndexOutput extends IndexOutput
IndexOutput writing to a ByteBuffersDataOutput.| Constructor and Description |
|---|
ByteBuffersIndexOutput(ByteBuffersDataOutput delegate,
String resourceDescription,
String name) |
ByteBuffersIndexOutput(ByteBuffersDataOutput delegate,
String resourceDescription,
String name,
Checksum checksum,
Consumer<ByteBuffersDataOutput> onClose) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this stream to further operations.
|
void |
copyBytes(DataInput input,
long numBytes)
Copy numBytes bytes from input to ourself.
|
long |
getChecksum()
Returns the current checksum of bytes written so far
|
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 length)
Writes an array of bytes.
|
void |
writeBytes(byte[] b,
int offset,
int length)
Writes an array of bytes.
|
void |
writeInt(int i)
Writes an int as four bytes.
|
void |
writeLong(long i)
Writes a long as eight bytes.
|
void |
writeMapOfStrings(Map<String,String> map)
Writes a String map.
|
void |
writeSetOfStrings(Set<String> set)
Writes a String set.
|
void |
writeShort(short i)
Writes a short as two bytes.
|
void |
writeString(String s)
Writes a string.
|
getName, toStringwriteVInt, writeVLong, writeZInt, writeZLongpublic ByteBuffersIndexOutput(ByteBuffersDataOutput delegate, String resourceDescription, String name)
public ByteBuffersIndexOutput(ByteBuffersDataOutput delegate, String resourceDescription, String name, Checksum checksum, Consumer<ByteBuffersDataOutput> onClose)
public void close()
throws IOException
IndexOutputclose in interface Closeableclose in interface AutoCloseableclose in class IndexOutputIOExceptionpublic long getFilePointer()
IndexOutputgetFilePointer in class IndexOutputpublic long getChecksum()
throws IOException
IndexOutputgetChecksum in class IndexOutputIOExceptionpublic void writeByte(byte b)
throws IOException
DataOutputThe 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 DataOutputIOExceptionDataInput.readByte()public void writeBytes(byte[] b,
int offset,
int length)
throws IOException
DataOutputwriteBytes in class DataOutputb - the bytes to writeoffset - the offset in the byte arraylength - the number of bytes to writeIOExceptionDataInput.readBytes(byte[],int,int)public void writeBytes(byte[] b,
int length)
throws IOException
DataOutputwriteBytes in class DataOutputb - the bytes to writelength - the number of bytes to writeIOExceptionDataInput.readBytes(byte[],int,int)public void writeInt(int i)
throws IOException
DataOutput32-bit unsigned integer written as four bytes, high-order bytes first.
writeInt in class DataOutputIOExceptionDataInput.readInt()public void writeShort(short i)
throws IOException
DataOutputwriteShort in class DataOutputIOExceptionDataInput.readShort()public void writeLong(long i)
throws IOException
DataOutput64-bit unsigned integer written as eight bytes, high-order bytes first.
writeLong in class DataOutputIOExceptionDataInput.readLong()public void writeString(String s) throws IOException
DataOutput
Writes strings as UTF-8 encoded bytes. First the length, in bytes, is
written as a VInt, followed by the bytes.
writeString in class DataOutputIOExceptionDataInput.readString()public void copyBytes(DataInput input, long numBytes) throws IOException
DataOutputcopyBytes in class DataOutputIOExceptionpublic void writeMapOfStrings(Map<String,String> map) throws IOException
DataOutput
First the size is written as an vInt,
followed by each key-value pair written as two consecutive
Strings.
writeMapOfStrings in class DataOutputmap - Input map.IOExceptionpublic void writeSetOfStrings(Set<String> set) throws IOException
DataOutput
First the size is written as an vInt,
followed by each value written as a
String.
writeSetOfStrings in class DataOutputset - Input set.IOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.