Class BytesStreamInput

java.lang.Object
java.io.InputStream
org.opensearch.core.common.io.stream.StreamInput
org.opensearch.core.common.io.stream.BytesStreamInput
All Implemented Interfaces:
Closeable, AutoCloseable

public class BytesStreamInput extends StreamInput
StreamInput version of Lucene's ByteArrayDataInput This is used as a replacement of Lucene ByteArrayDataInput for abstracting byte order changes in Lucene's API

Attribution given to apache lucene project under ALv2: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Opensearch.internal:
  • Constructor Details

    • BytesStreamInput

      public BytesStreamInput(byte[] bytes)
    • BytesStreamInput

      public BytesStreamInput(byte[] bytes, int offset, int len)
    • BytesStreamInput

      public BytesStreamInput()
  • Method Details

    • reset

      public void reset(byte[] bytes)
    • getPosition

      public int getPosition()
    • setPosition

      public void setPosition(int pos)
    • reset

      public void reset(byte[] bytes, int offset, int len)
    • eof

      public boolean eof()
    • skipBytes

      public void skipBytes(long count)
    • readByte

      public byte readByte() throws EOFException
      Description copied from class: StreamInput
      Reads and returns a single byte.
      Specified by:
      readByte in class StreamInput
      Throws:
      EOFException
    • readBytes

      public void readBytes(byte[] b, int offset, int len) throws EOFException
      Description copied from class: StreamInput
      Reads a specified number of bytes into an array at the specified offset.
      Specified by:
      readBytes in class StreamInput
      Parameters:
      b - the array to read bytes into
      offset - the offset in the array to start storing bytes
      len - the number of bytes to read
      Throws:
      EOFException
    • close

      public void close()
      Description copied from class: StreamInput
      Closes the stream to further operations.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class StreamInput
    • available

      public int available()
      Specified by:
      available in class StreamInput
    • ensureCanReadBytes

      protected void ensureCanReadBytes(int length) throws EOFException
      Description copied from class: StreamInput
      This method throws an EOFException if the given number of bytes can not be read from the this stream. This method might be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.
      Specified by:
      ensureCanReadBytes in class StreamInput
      Throws:
      EOFException
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • readShort

      public short readShort() throws IOException
      Overrides:
      readShort in class StreamInput
      Throws:
      IOException
    • readInt

      public int readInt() throws IOException
      Description copied from class: StreamInput
      Reads four bytes and returns an int.
      Overrides:
      readInt in class StreamInput
      Throws:
      IOException
    • readLong

      public long readLong() throws IOException
      Description copied from class: StreamInput
      Reads eight bytes and returns a long.
      Overrides:
      readLong in class StreamInput
      Throws:
      IOException