Package com.persistit.exception

Examples of com.persistit.exception.ConversionException


        if (type == TYPE_BOOLEAN_FALSE) {
            v = false;
        } else if (type == TYPE_BOOLEAN_TRUE) {
            v = true;
        } else
            throw new ConversionException("Invalid boolean type " + type);
        _index = decodeEnd(_index + 1);
        return v;
    }
View Full Code Here


    public byte decodeByte() {
        final int type = getTypeCode();
        if (type >= TYPE_BYTE && type <= TYPE_BYTE + (EWIDTH_BYTE * 2)) {
            return (byte) decodeInt();
        }
        throw new ConversionException("Invalid byte type " + type);
    }
View Full Code Here

    public short decodeShort() {
        final int type = getTypeCode();
        if (type >= TYPE_BYTE && type <= TYPE_SHORT + (EWIDTH_SHORT * 2)) {
            return (short) decodeInt();
        }
        throw new ConversionException("Invalid short type " + type);
    }
View Full Code Here

    public char decodeChar() {
        final int type = getTypeCode();
        if (type >= TYPE_CHAR && type <= TYPE_CHAR + EWIDTH_CHAR) {
            return (char) decodeInt();
        }
        throw new ConversionException("Invalid char type " + type);
    }
View Full Code Here

            // intentionally falls through;
        case TYPE_INT + EWIDTH_INT * 2 - 5:
            break;

        default:
            throw new ConversionException("Invalid integer type " + type);
        }

        _index = index;
        return result;
    }
View Full Code Here

            // intentionally falls through;
        case TYPE_LONG + EWIDTH_LONG * 2 - 9:
            break;

        default:
            throw new ConversionException("Invalid long type " + type);
        }
        _index = index;
        return result;
    }
View Full Code Here

            for (;;) {
                final int b = (_bytes[index++]) & 0xFF;
                if (b == 0)
                    break;
                if (shift == 0) {
                    throw new ConversionException("Unexpected float byte value " + b + " at " + (index - 1));
                }
                if (shift > 7) {
                    bits = (bits << 7) | (b & 0x7F);
                    shift -= 7;
                } else {
                    bits = (bits << shift) | ((b & 0x7F) >> (7 - shift));
                    shift = 0;
                }
            }
            if (shift > 0)
                bits <<= shift;
            if ((bits & 0x80000000) != 0) {
                bits ^= -0x80000000;
            } else {
                bits = ~bits;
            }
            result = Float.intBitsToFloat(bits);
        } else {
            throw new ConversionException("Mismatched type " + type + " is not TYPE_FLOAT at " + _index);
        }
        _index = index;
        return result;
    }
View Full Code Here

            for (;;) {
                final long b = (_bytes[index++]) & 0xFF;
                if (b == 0)
                    break;
                if (shift == 0) {
                    throw new ConversionException("Unexpected float byte value " + b + " at " + (index - 1));
                }
                if (shift > 7) {
                    bits = (bits << 7) | (b & 0x7FL);
                    shift -= 7;
                } else {
                    bits = (bits << shift) | ((b & 0x7FL) >> (7 - shift));
                    shift = 0;
                }
            }
            if (shift > 0)
                bits <<= shift;
            if ((bits & 0x8000000000000000L) != 0) {
                bits ^= -0x8000000000000000L;
            } else {
                bits = ~bits;
            }
            result = Double.longBitsToDouble(bits);
        } else {
            throw new ConversionException("Mismatched type " + type + " is not TYPE_DOUBLE at " + _index);
        }
        _index = index;
        return result;
    }
View Full Code Here

        int index = _index;
        try {
            final int type = getTypeCode();
            _index++;
            if (type != TYPE_DATE) {
                throw new ConversionException("Invalid Date lead-in byte (" + type + ") at position " + _index
                        + " in key");
            }
            final Date result = new Date(decodeLongInternal());
            index = decodeEnd(_index);
            return result;
View Full Code Here

     */
    public BigInteger decodeBigInteger() {
        int index = _index;
        final int type = getTypeCode();
        if (type != TYPE_BIG_INTEGER) {
            throw new ConversionException("Invalid String lead-in byte (" + type + ") at position " + _index
                    + " in key");
        }
        _index++;
        try {
            final BigIntegerStruct bis = new BigIntegerStruct();
View Full Code Here

TOP

Related Classes of com.persistit.exception.ConversionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.