Package org.apache.lucene.store
Class DataOutput
- java.lang.Object
-
- org.apache.lucene.store.DataOutput
-
- Direct Known Subclasses:
ByteArrayDataOutput,IndexOutput,OutputStreamDataOutput,PagedBytes.PagedBytesDataOutput
public abstract class DataOutput extends Object
Abstract base class for performing write operations of Lucene's low-level data types.
-
-
Constructor Summary
Constructors Constructor Description DataOutput()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcopyBytes(DataInput input, long numBytes)Copy numBytes bytes from input to ourself.abstract voidwriteByte(byte b)Writes a single byte.voidwriteBytes(byte[] b, int length)Writes an array of bytes.abstract voidwriteBytes(byte[] b, int offset, int length)Writes an array of bytes.voidwriteChars(char[] s, int start, int length)Deprecated.-- please pre-convert to utf8 bytes instead or usewriteString(java.lang.String)voidwriteChars(String s, int start, int length)Deprecated.-- please pre-convert to utf8 bytes instead or usewriteString(java.lang.String)voidwriteInt(int i)Writes an int as four bytes.voidwriteLong(long i)Writes a long as eight bytes.voidwriteShort(short i)Writes a short as two bytes.voidwriteString(String s)Writes a string.voidwriteStringStringMap(Map<String,String> map)voidwriteVInt(int i)Writes an int in a variable-length format.voidwriteVLong(long i)Writes an long in a variable-length format.
-
-
-
Method Detail
-
writeByte
public abstract void writeByte(byte b) throws IOExceptionWrites a single byte.- Throws:
IOException- See Also:
DataInput.readByte()
-
writeBytes
public void writeBytes(byte[] b, int length) throws IOExceptionWrites an array of bytes.- Parameters:
b- the bytes to writelength- the number of bytes to write- Throws:
IOException- See Also:
DataInput.readBytes(byte[],int,int)
-
writeBytes
public abstract void writeBytes(byte[] b, int offset, int length) throws IOExceptionWrites an array of bytes.- Parameters:
b- the bytes to writeoffset- the offset in the byte arraylength- the number of bytes to write- Throws:
IOException- See Also:
DataInput.readBytes(byte[],int,int)
-
writeInt
public void writeInt(int i) throws IOExceptionWrites an int as four bytes.- Throws:
IOException- See Also:
DataInput.readInt()
-
writeShort
public void writeShort(short i) throws IOExceptionWrites a short as two bytes.- Throws:
IOException- See Also:
DataInput.readShort()
-
writeVInt
public final void writeVInt(int i) throws IOExceptionWrites an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are supported, but should be avoided.- Throws:
IOException- See Also:
DataInput.readVInt()
-
writeLong
public void writeLong(long i) throws IOExceptionWrites a long as eight bytes.- Throws:
IOException- See Also:
DataInput.readLong()
-
writeVLong
public final void writeVLong(long i) throws IOExceptionWrites an long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.- Throws:
IOException- See Also:
DataInput.readVLong()
-
writeString
public void writeString(String s) throws IOException
Writes a string.- Throws:
IOException- See Also:
DataInput.readString()
-
copyBytes
public void copyBytes(DataInput input, long numBytes) throws IOException
Copy numBytes bytes from input to ourself.- Throws:
IOException
-
writeChars
@Deprecated public void writeChars(String s, int start, int length) throws IOException
Deprecated.-- please pre-convert to utf8 bytes instead or usewriteString(java.lang.String)Writes a sub sequence of characters from s as the old format (modified UTF-8 encoded bytes).- Parameters:
s- the source of the charactersstart- the first character in the sequencelength- the number of characters in the sequence- Throws:
IOException
-
writeChars
@Deprecated public void writeChars(char[] s, int start, int length) throws IOException
Deprecated.-- please pre-convert to utf8 bytes instead or usewriteString(java.lang.String)Writes a sub sequence of characters from char[] as the old format (modified UTF-8 encoded bytes).- Parameters:
s- the source of the charactersstart- the first character in the sequencelength- the number of characters in the sequence- Throws:
IOException
-
writeStringStringMap
public void writeStringStringMap(Map<String,String> map) throws IOException
- Throws:
IOException
-
-