Class GridUnsafeDataInput

java.lang.Object
java.io.InputStream
org.gridgain.internal.dr.optimized.GridUnsafeDataInput
All Implemented Interfaces:
Closeable, DataInput, AutoCloseable, org.apache.ignite.internal.util.io.IgniteDataInput

public class GridUnsafeDataInput extends InputStream implements org.apache.ignite.internal.util.io.IgniteDataInput
Data input based on Unsafe operations compatible with GG-8 implementation.
  • Constructor Details

    • GridUnsafeDataInput

      public GridUnsafeDataInput()
      Creates a new input with auto-shrinking disabled and no internal buffer assigned.
    • GridUnsafeDataInput

      public GridUnsafeDataInput(long shrinkCheckFrequencyMs)
      Creates a new input with no internal buffer assigned.
      Parameters:
      shrinkCheckFrequencyMs - how often to check whether an underlying byte buffer needs to be shrunk (disables the auto-shrinking if it's -1)
    • GridUnsafeDataInput

      public GridUnsafeDataInput(byte[] bytes)
      Creates a new input with auto-shrinking disabled.
      Parameters:
      bytes - array to initially (before automatic resize) use as an internal buffer
    • GridUnsafeDataInput

      public GridUnsafeDataInput(byte[] bytes, long shrinkCheckFrequencyMs)
      Creates a new input.
      Parameters:
      bytes - array to initially (before automatic resize) use as an internal buffer
      shrinkCheckFrequencyMs - how often to check whether an underlying byte buffer needs to be shrunk (disables the auto-shrinking if it's -1)
  • Method Details

    • bytes

      public void bytes(byte[] bytes, int len)
      Specified by:
      bytes in interface org.apache.ignite.internal.util.io.IgniteDataInput
    • bytes

      public void bytes(byte[] bytes, int off, int len)
      Sets the internal buffer.
      Parameters:
      bytes - Bytes.
      off - Offset.
      len - Length.
    • inputStream

      public void inputStream(InputStream in) throws IOException
      Specified by:
      inputStream in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • reset

      public void reset() throws IOException
      Specified by:
      reset in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Overrides:
      reset in class InputStream
      Throws:
      IOException
    • cleanup

      public void cleanup() throws IOException
      Specified by:
      cleanup in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readByteArray

      public byte[] readByteArray(int arrSize) throws IOException
      Specified by:
      readByteArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readShortArray

      public short[] readShortArray(int arrSize) throws IOException
      Specified by:
      readShortArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readIntArray

      public int[] readIntArray(int arrSize) throws IOException
      Specified by:
      readIntArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readDoubleArray

      public double[] readDoubleArray(int arrSize) throws IOException
      Specified by:
      readDoubleArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readBooleanArray

      public boolean[] readBooleanArray(int arrSize) throws IOException
      Specified by:
      readBooleanArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readCharArray

      public char[] readCharArray(int arrSize) throws IOException
      Specified by:
      readCharArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readBigInteger

      public BigInteger readBigInteger() throws IOException
      Specified by:
      readBigInteger in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readBigDecimal

      public BigDecimal readBigDecimal() throws IOException
      Specified by:
      readBigDecimal in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readLocalTime

      public LocalTime readLocalTime() throws IOException
      Specified by:
      readLocalTime in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readLocalDate

      public LocalDate readLocalDate() throws IOException
      Specified by:
      readLocalDate in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readLocalDateTime

      public LocalDateTime readLocalDateTime() throws IOException
      Specified by:
      readLocalDateTime in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readInstant

      public Instant readInstant() throws IOException
      Specified by:
      readInstant in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readDuration

      public Duration readDuration() throws IOException
      Specified by:
      readDuration in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readPeriod

      public Period readPeriod() throws IOException
      Specified by:
      readPeriod in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readUuid

      public UUID readUuid() throws IOException
      Specified by:
      readUuid in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readBitSet

      public BitSet readBitSet() throws IOException
      Specified by:
      readBitSet in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readLongArray

      public long[] readLongArray(int arrSize) throws IOException
      Specified by:
      readLongArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readFloatArray

      public float[] readFloatArray(int arrSize) throws IOException
      Specified by:
      readFloatArray in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readFewBytes

      public int readFewBytes(byte[] b, int off, int len) throws IOException
      Specified by:
      readFewBytes in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readFully

      public void readFully(byte[] b) throws IOException
      Specified by:
      readFully in interface DataInput
      Throws:
      IOException
    • readFully

      public void readFully(byte[] b, int off, int len) throws IOException
      Specified by:
      readFully in interface DataInput
      Throws:
      IOException
    • skipBytes

      public int skipBytes(int n)
      Specified by:
      skipBytes in interface DataInput
    • readBoolean

      public boolean readBoolean() throws IOException
      Specified by:
      readBoolean in interface DataInput
      Throws:
      IOException
    • readByte

      public byte readByte() throws IOException
      Specified by:
      readByte in interface DataInput
      Throws:
      IOException
    • readUnsignedByte

      public int readUnsignedByte() throws IOException
      Specified by:
      readUnsignedByte in interface DataInput
      Throws:
      IOException
    • readShort

      public short readShort() throws IOException
      Specified by:
      readShort in interface DataInput
      Throws:
      IOException
    • readUnsignedShort

      public int readUnsignedShort() throws IOException
      Specified by:
      readUnsignedShort in interface DataInput
      Throws:
      IOException
    • readChar

      public char readChar() throws IOException
      Specified by:
      readChar in interface DataInput
      Throws:
      IOException
    • readInt

      public int readInt() throws IOException
      Specified by:
      readInt in interface DataInput
      Throws:
      IOException
    • readLong

      public long readLong() throws IOException
      Specified by:
      readLong in interface DataInput
      Throws:
      IOException
    • readFloat

      public float readFloat() throws IOException
      Specified by:
      readFloat in interface DataInput
      Throws:
      IOException
    • readDouble

      public double readDouble() throws IOException
      Specified by:
      readDouble in interface DataInput
      Throws:
      IOException
    • read

      public int read() throws IOException
      Specified by:
      read in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Specified by:
      read in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Overrides:
      read in class InputStream
      Throws:
      IOException
    • readVarInt

      public long readVarInt() throws IOException
      Specified by:
      readVarInt in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • readLine

      public String readLine() throws IOException
      Specified by:
      readLine in interface DataInput
      Throws:
      IOException
    • readUTF

      public String readUTF() throws IOException
      Specified by:
      readUTF in interface DataInput
      Throws:
      IOException
    • readUtfBody

      protected String readUtfBody(long utfLen) throws IOException
      Reads in the "body" (i.e., the UTF representation minus the 2-byte or 8-byte length header) of a UTF encoding, which occupies the next utfLen bytes.
      Parameters:
      utfLen - UTF encoding length.
      Returns:
      String.
      Throws:
      IOException - In case of error.
    • mark

      public void mark(int readLimit)
      Specified by:
      mark in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Overrides:
      mark in class InputStream
    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class InputStream
    • available

      public int available() throws IOException
      Specified by:
      available in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Overrides:
      available in class InputStream
      Throws:
      IOException
    • materializeFromNextBytes

      public <T> T materializeFromNextBytes(int bytesCount, org.apache.ignite.internal.util.io.IgniteDataInput.Materializer<? extends T> materializer) throws IOException
      Specified by:
      materializeFromNextBytes in interface org.apache.ignite.internal.util.io.IgniteDataInput
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object