Search in sources :

Example 21 with NulsException

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);
    }
}
Also used : NulsException(io.nuls.kernel.exception.NulsException)

Example 22 with NulsException

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);
    }
}
Also used : NulsException(io.nuls.kernel.exception.NulsException)

Example 23 with NulsException

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);
    }
}
Also used : NulsException(io.nuls.kernel.exception.NulsException)

Example 24 with NulsException

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);
    }
}
Also used : NulsException(io.nuls.kernel.exception.NulsException)

Example 25 with NulsException

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);
    }
}
Also used : NulsException(io.nuls.kernel.exception.NulsException)

Aggregations

NulsException (io.nuls.kernel.exception.NulsException)109 IOException (java.io.IOException)35 Account (io.nuls.account.model.Account)25 ValidateResult (io.nuls.kernel.validate.ValidateResult)23 ECKey (io.nuls.core.tools.crypto.ECKey)20 CoinDataResult (io.nuls.account.ledger.model.CoinDataResult)18 NulsRuntimeException (io.nuls.kernel.exception.NulsRuntimeException)16 UnsupportedEncodingException (java.io.UnsupportedEncodingException)14 TransferTransaction (io.nuls.protocol.model.tx.TransferTransaction)13 Coin (io.nuls.kernel.model.Coin)12 MultiSigAccount (io.nuls.account.model.MultiSigAccount)11 ContractResult (io.nuls.contract.dto.ContractResult)9 NulsByteBuffer (io.nuls.kernel.utils.NulsByteBuffer)9 ArrayList (java.util.ArrayList)9 TransactionSignature (io.nuls.kernel.script.TransactionSignature)8 BigInteger (java.math.BigInteger)8 TransactionDataResult (io.nuls.account.ledger.model.TransactionDataResult)7 AccountPo (io.nuls.account.storage.po.AccountPo)7 AliasPo (io.nuls.account.storage.po.AliasPo)7 CryptoException (io.nuls.core.tools.crypto.Exception.CryptoException)7