org.apache.lucene.util

## Class OfflineSorter.ByteSequencesWriter

- java.lang.Object
- - org.apache.lucene.util.OfflineSorter.ByteSequencesWriter

- All Implemented Interfaces:
    Closeable, AutoCloseable
  Enclosing class:
    OfflineSorter

      public static class OfflineSorter.ByteSequencesWriter
      extends Object
      implements Closeable

  Utility class to emit length-prefixed byte[] entries to an output stream for sorting. Complementary to `OfflineSorter.ByteSequencesReader`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OfflineSorter.ByteSequencesWriter(DataOutput os)` Constructs a ByteSequencesWriter to the provided DataOutput
    `OfflineSorter.ByteSequencesWriter(Path path)` Constructs a ByteSequencesWriter to the provided Path

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the provided `DataOutput` if it is `Closeable`.
    `void` | `write(byte[] bytes)` Writes a byte array.
    `void` | `write(byte[] bytes, int off, int len)` Writes a byte array.
    `void` | `write(BytesRef ref)` Writes a BytesRef.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OfflineSorter.ByteSequencesWriter

          public OfflineSorter.ByteSequencesWriter(Path path)
                                            throws IOException

      Constructs a ByteSequencesWriter to the provided Path
      Throws:
        `IOException`

    - #### OfflineSorter.ByteSequencesWriter

          public OfflineSorter.ByteSequencesWriter(DataOutput os)

      Constructs a ByteSequencesWriter to the provided DataOutput

  - ### Method Detail

    - #### write

          public void write(BytesRef ref)
                     throws IOException

      Writes a BytesRef.
      Throws:
        `IOException`
      See Also:
        `write(byte[], int, int)`

    - #### write

          public void write(byte[] bytes)
                     throws IOException

      Writes a byte array.
      Throws:
        `IOException`
      See Also:
        `write(byte[], int, int)`

    - #### write

          public void write(byte[] bytes,
                   int off,
                   int len)
                     throws IOException

      Writes a byte array.

      The length is written as a `short`, followed by the bytes.

      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Closes the provided `DataOutput` if it is `Closeable`.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.