Class SdkDataReader
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.config.SdkDataReader
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancanReadSize(int size) Returns true if it's possible to read at least |size| of bytes from stream.intReturns current reading offset.readByte()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.intReturns remaining size available in the stream.voidreset()Resets data reader to its initial state.booleanskipBytes(int size) Skips required number of bytes in the stream.
-
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:DataReaderResets data reader to its initial state.- Specified by:
resetin interfaceDataReader
-
remainingSize
public int remainingSize()Description copied from interface:DataReaderReturns remaining size available in the stream.- Specified by:
remainingSizein interfaceDataReader- Returns:
- Remaining size.
-
currentOffset
public int currentOffset()Description copied from interface:DataReaderReturns current reading offset.- Specified by:
currentOffsetin interfaceDataReader- Returns:
- Current reading offset.
-
canReadSize
public boolean canReadSize(int size) Description copied from interface:DataReaderReturns true if it's possible to read at least |size| of bytes from stream.- Specified by:
canReadSizein interfaceDataReader- Parameters:
size- Byte size.- Returns:
- True if reader can read next bytes.
-
skipBytes
public boolean skipBytes(int size) Description copied from interface:DataReaderSkips required number of bytes in the stream. Returns false, if there's not enough bytes left.- Specified by:
skipBytesin interfaceDataReader- Parameters:
size- Byte size.- Returns:
- True if skip was successful.
-
readData
public byte[] readData(int expectedSize) Description copied from interface:DataReaderReads a data object into output byte array.- Specified by:
readDatain interfaceDataReader- Parameters:
expectedSize- Expected byte array size or 0 for any size.- Returns:
- Read data.
-
readString
Description copied from interface:DataReaderReads a string object into output byte array.- Specified by:
readStringin interfaceDataReader- Returns:
- Read string.
-
readRaw
public byte[] readRaw(int size) Description copied from interface:DataReaderReads an exact number of bytes into output byte array. Unlike theDataReader.readData(int)method, this method reads just exact number of bytes from the stream, without any size marker.- Specified by:
readRawin interfaceDataReader- Parameters:
size- Byte size.- Returns:
- Read bytes.
-
readByte
Description copied from interface:DataReaderReads one byte into output byte array.- Specified by:
readBytein interfaceDataReader- Returns:
- Read byte.
-
readCount
Description copied from interface:DataReaderReturns count from data stream.- Specified by:
readCountin interfaceDataReader- Returns:
- Count.
-