Show / Hide Table of Contents

    Class DataOutput

    Abstract base class for performing write operations of Lucene's low-level data types.

    DataOutput may only be used from one thread, because it is not thread safe (it keeps internal state like file position).

    Inheritance
    System.Object
    DataOutput
    ByteArrayDataOutput
    IndexOutput
    OutputStreamDataOutput
    BinaryWriterDataOutput
    GrowableByteArrayDataOutput
    PagedBytes.PagedBytesDataOutput
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class DataOutput : object

    Methods

    | Improve this Doc View Source

    CopyBytes(DataInput, Int64)

    Copy numBytes bytes from input to ourself.

    Declaration
    public virtual void CopyBytes(DataInput input, long numBytes)
    Parameters
    Type Name Description
    DataInput input
    System.Int64 numBytes
    | Improve this Doc View Source

    WriteByte(Byte)

    Writes a single byte.

    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.

    Declaration
    public abstract void WriteByte(byte b)
    Parameters
    Type Name Description
    System.Byte b
    See Also
    ReadByte()
    | Improve this Doc View Source

    WriteBytes(Byte[], Int32)

    Writes an array of bytes.

    Declaration
    public virtual void WriteBytes(byte[] b, int length)
    Parameters
    Type Name Description
    System.Byte[] b

    the bytes to write

    System.Int32 length

    the number of bytes to write

    See Also
    ReadBytes(System.Byte[], System.Int32, System.Int32)
    | Improve this Doc View Source

    WriteBytes(Byte[], Int32, Int32)

    Writes an array of bytes.

    Declaration
    public abstract void WriteBytes(byte[] b, int offset, int length)
    Parameters
    Type Name Description
    System.Byte[] b

    the bytes to write

    System.Int32 offset

    the offset in the byte array

    System.Int32 length

    the number of bytes to write

    See Also
    ReadBytes(System.Byte[], System.Int32, System.Int32)
    | Improve this Doc View Source

    WriteInt16(Int16)

    Writes a short as two bytes.

    NOTE: this was writeShort() in Lucene

    Declaration
    public virtual void WriteInt16(short i)
    Parameters
    Type Name Description
    System.Int16 i
    See Also
    ReadInt16()
    | Improve this Doc View Source

    WriteInt32(Int32)

    Writes an as four bytes.

    32-bit unsigned integer written as four bytes, high-order bytes first.

    NOTE: this was writeInt() in Lucene

    Declaration
    public virtual void WriteInt32(int i)
    Parameters
    Type Name Description
    System.Int32 i
    See Also
    ReadInt32()
    | Improve this Doc View Source

    WriteInt64(Int64)

    Writes a as eight bytes.

    64-bit unsigned integer written as eight bytes, high-order bytes first.

    NOTE: this was writeLong() in Lucene

    Declaration
    public virtual void WriteInt64(long i)
    Parameters
    Type Name Description
    System.Int64 i
    See Also
    ReadInt64()
    | Improve this Doc View Source

    WriteString(String)

    Writes a string.

    Writes strings as UTF-8 encoded bytes. First the length, in bytes, is written as a WriteVInt32(Int32), followed by the bytes.

    Declaration
    public virtual void WriteString(string s)
    Parameters
    Type Name Description
    System.String s
    See Also
    ReadString()
    | Improve this Doc View Source

    WriteStringSet(ISet<String>)

    Writes a set.

    First the size is written as an WriteInt32(Int32), followed by each value written as a WriteString(String).

    Declaration
    public virtual void WriteStringSet(ISet<string> set)
    Parameters
    Type Name Description
    ISet<System.String> set

    Input ISet{string}. May be null (equivalent to an empty set)

    | Improve this Doc View Source

    WriteStringStringMap(IDictionary<String, String>)

    Writes a .

    First the size is written as an WriteInt32(Int32), followed by each key-value pair written as two consecutive WriteString(String)s.

    Declaration
    public virtual void WriteStringStringMap(IDictionary<string, string> map)
    Parameters
    Type Name Description
    IDictionary<System.String, System.String> map

    Input . May be null (equivalent to an empty dictionary)

    | Improve this Doc View Source

    WriteVInt32(Int32)

    Writes an in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are supported, but should be avoided.

    VByte is a variable-length format for positive integers is defined where the high-order bit of each byte indicates whether more bytes remain to be read. The low-order seven bits are appended as increasingly more significant bits in the resulting integer value. Thus values from zero to 127 may be stored in a single byte, values from 128 to 16,383 may be stored in two bytes, and so on.

    VByte Encoding Example

    ValueByte 1Byte 2Byte 3
    000000000
    100000001
    200000010
    ...
    12701111111
    1281000000000000001
    1291000000100000001
    1301000001000000001
    ...
    16,3831111111101111111
    16,384100000001000000000000001
    16,385100000011000000000000001
    ...

    this provides compression while still being efficient to decode.

    NOTE: this was writeVInt() in Lucene

    Declaration
    public void WriteVInt32(int i)
    Parameters
    Type Name Description
    System.Int32 i

    Smaller values take fewer bytes. Negative numbers are supported, but should be avoided.

    See Also
    ReadVInt32()
    | Improve this Doc View Source

    WriteVInt64(Int64)

    Writes an in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

    The format is described further in WriteVInt32(Int32).

    NOTE: this was writeVLong() in Lucene

    Declaration
    public void WriteVInt64(long i)
    Parameters
    Type Name Description
    System.Int64 i
    See Also
    ReadVInt64()
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)