java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.config.SdkDataReader
All Implemented Interfaces:
DataReader

public class SdkDataReader extends Object implements DataReader
Data reader implementation for PowerAuth mobile SDK, see: https://github.com/wultra/powerauth-mobile-sdk/blob/develop/src/PowerAuth/utils/DataReader.cpp
Author:
Roman Strobl, roman.strobl@wultra.com
  • Constructor Summary

    Constructors
    Constructor
    Description
    SdkDataReader(byte[] data)
    SDK reader constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canReadSize(int size)
    Returns true if it's possible to read at least |size| of bytes from stream.
    int
    Returns current reading offset.
    Reads one byte into output byte array.
    Returns count from data stream.
    byte[]
    readData(int expectedSize)
    Reads a data object into output byte array.
    byte[]
    readRaw(int size)
    Reads an exact number of bytes into output byte array.
    Reads a string object into output byte array.
    int
    Returns remaining size available in the stream.
    void
    Resets data reader to its initial state.
    boolean
    skipBytes(int size)
    Skips required number of bytes in the stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SdkDataReader

      public SdkDataReader(byte[] data)
      SDK reader constructor.
      Parameters:
      data - Binary data to read.
  • Method Details

    • reset

      public void reset()
      Description copied from interface: DataReader
      Resets data reader to its initial state.
      Specified by:
      reset in interface DataReader
    • remainingSize

      public int remainingSize()
      Description copied from interface: DataReader
      Returns remaining size available in the stream.
      Specified by:
      remainingSize in interface DataReader
      Returns:
      Remaining size.
    • currentOffset

      public int currentOffset()
      Description copied from interface: DataReader
      Returns current reading offset.
      Specified by:
      currentOffset in interface DataReader
      Returns:
      Current reading offset.
    • canReadSize

      public boolean canReadSize(int size)
      Description copied from interface: DataReader
      Returns true if it's possible to read at least |size| of bytes from stream.
      Specified by:
      canReadSize in interface DataReader
      Parameters:
      size - Byte size.
      Returns:
      True if reader can read next bytes.
    • skipBytes

      public boolean skipBytes(int size)
      Description copied from interface: DataReader
      Skips required number of bytes in the stream. Returns false, if there's not enough bytes left.
      Specified by:
      skipBytes in interface DataReader
      Parameters:
      size - Byte size.
      Returns:
      True if skip was successful.
    • readData

      public byte[] readData(int expectedSize)
      Description copied from interface: DataReader
      Reads a data object into output byte array.
      Specified by:
      readData in interface DataReader
      Parameters:
      expectedSize - Expected byte array size or 0 for any size.
      Returns:
      Read data.
    • readString

      public String readString()
      Description copied from interface: DataReader
      Reads a string object into output byte array.
      Specified by:
      readString in interface DataReader
      Returns:
      Read string.
    • readRaw

      public byte[] readRaw(int size)
      Description copied from interface: DataReader
      Reads an exact number of bytes into output byte array. Unlike the DataReader.readData(int) method, this method reads just exact number of bytes from the stream, without any size marker.
      Specified by:
      readRaw in interface DataReader
      Parameters:
      size - Byte size.
      Returns:
      Read bytes.
    • readByte

      public Byte readByte()
      Description copied from interface: DataReader
      Reads one byte into output byte array.
      Specified by:
      readByte in interface DataReader
      Returns:
      Read byte.
    • readCount

      public Integer readCount()
      Description copied from interface: DataReader
      Returns count from data stream.
      Specified by:
      readCount in interface DataReader
      Returns:
      Count.