use of io.nuls.kernel.exception.NulsException in project nuls by nuls-io.
the class NulsByteBuffer method readUint32.
public long readUint32() throws NulsException {
try {
long val = SerializeUtils.readUint32LE(payload, cursor);
cursor += 4;
return val;
} catch (ArrayIndexOutOfBoundsException e) {
throw new NulsException(KernelErrorCode.DATA_PARSE_ERROR, e);
}
}
use of io.nuls.kernel.exception.NulsException in project nuls by nuls-io.
the class NulsByteBuffer method readByte.
public byte readByte() throws NulsException {
try {
byte b = payload[cursor];
cursor += 1;
return b;
} catch (IndexOutOfBoundsException e) {
throw new NulsException(KernelErrorCode.DATA_PARSE_ERROR, e);
}
}
use of io.nuls.kernel.exception.NulsException in project nuls by nuls-io.
the class NulsByteBuffer method readVarInt.
public long readVarInt(int offset) throws NulsException {
try {
VarInt varint = new VarInt(payload, cursor + offset);
cursor += offset + varint.getOriginalSizeInBytes();
return varint.value;
} catch (ArrayIndexOutOfBoundsException e) {
throw new NulsException(KernelErrorCode.DATA_PARSE_ERROR, e);
}
}
use of io.nuls.kernel.exception.NulsException in project nuls by nuls-io.
the class NulsByteBuffer method readBytes.
public byte[] readBytes(int length) throws NulsException {
try {
byte[] b = new byte[length];
System.arraycopy(payload, cursor, b, 0, length);
cursor += length;
return b;
} catch (IndexOutOfBoundsException e) {
throw new NulsException(KernelErrorCode.DATA_PARSE_ERROR, e);
}
}
use of io.nuls.kernel.exception.NulsException in project nuls by nuls-io.
the class NulsByteBuffer method readInt32.
public int readInt32() throws NulsException {
try {
int u = SerializeUtils.readInt32LE(payload, cursor);
cursor += 4;
return u;
} catch (ArrayIndexOutOfBoundsException e) {
throw new NulsException(KernelErrorCode.DATA_PARSE_ERROR, e);
}
}
Aggregations