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, toString
writeVInt, writeVLong, writeZInt, writeZLong
public 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
IndexOutput
close
in interface Closeable
close
in interface AutoCloseable
close
in class IndexOutput
IOException
public long getFilePointer()
IndexOutput
getFilePointer
in class IndexOutput
public long getChecksum() throws IOException
IndexOutput
getChecksum
in class IndexOutput
IOException
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()
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 writeBytes(byte[] b, int length) throws IOException
DataOutput
writeBytes
in class DataOutput
b
- the bytes to writelength
- the number of bytes to writeIOException
DataInput.readBytes(byte[],int,int)
public void writeInt(int i) throws IOException
DataOutput
32-bit unsigned integer written as four bytes, high-order bytes first.
writeInt
in class DataOutput
IOException
DataInput.readInt()
public void writeShort(short i) throws IOException
DataOutput
writeShort
in class DataOutput
IOException
DataInput.readShort()
public void writeLong(long i) throws IOException
DataOutput
64-bit unsigned integer written as eight bytes, high-order bytes first.
writeLong
in class DataOutput
IOException
DataInput.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 DataOutput
IOException
DataInput.readString()
public void copyBytes(DataInput input, long numBytes) throws IOException
DataOutput
copyBytes
in class DataOutput
IOException
public 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
String
s.
writeMapOfStrings
in class DataOutput
map
- Input map.IOException
public 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 DataOutput
set
- Input set.IOException
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.