Package voldemort.serialization

Examples of voldemort.serialization.SerializationException


        else if(c == Short.class)
            return ((Short) o).longValue();
        else if(c == Integer.class)
            return ((Integer) o).longValue();
        else
            throw new SerializationException("Object of type " + c.getName()
                                             + " cannot be coerced to type " + JsonTypes.INT64
                                             + " as the schema specifies.");
    }
View Full Code Here


        else if(c == Short.class)
            return ((Short) o).floatValue();
        else if(c == Integer.class)
            return ((Integer) o).floatValue();
        else
            throw new SerializationException("Object of type " + c.getName()
                                             + " cannot be coerced to type " + JsonTypes.FLOAT32
                                             + " as the schema specifies.");
    }
View Full Code Here

        else if(c == Integer.class)
            return ((Integer) o).doubleValue();
        else if(c == Float.class)
            return ((Float) o).doubleValue();
        else
            throw new SerializationException("Object of type " + c.getName()
                                             + " cannot be coerced to type " + JsonTypes.FLOAT32
                                             + " as the schema specifies.");
    }
View Full Code Here

    private void writeInt8(DataOutputStream output, Byte b) throws IOException {
        if(b == null)
            output.writeByte(Byte.MIN_VALUE);
        else if(b.byteValue() == Byte.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Byte.MIN_VALUE
                                             + " in int8, but minimum value is "
                                             + (Byte.MIN_VALUE - 1) + ".");
        else
            output.writeByte(b.byteValue());
    }
View Full Code Here

    private void writeInt16(DataOutputStream output, Short s) throws IOException {
        if(s == null)
            output.writeShort(Short.MIN_VALUE);
        else if(s.shortValue() == Short.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Short.MIN_VALUE
                                             + " in int16, but minimum value is "
                                             + (Short.MIN_VALUE - 1) + ".");
        else
            output.writeShort(s.shortValue());
    }
View Full Code Here

    private void writeInt32(DataOutputStream output, Integer i) throws IOException {
        if(i == null)
            output.writeInt(Integer.MIN_VALUE);
        else if(i.intValue() == Integer.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Integer.MIN_VALUE
                                             + " in int32, but minimum value is "
                                             + (Integer.MIN_VALUE - 1) + ".");
        else
            output.writeInt(i.intValue());
    }
View Full Code Here

    private void writeInt64(DataOutputStream output, Long l) throws IOException {
        if(l == null)
            output.writeLong(Long.MIN_VALUE);
        else if(l.longValue() == Long.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Long.MIN_VALUE
                                             + " in int64, but minimum value is "
                                             + (Long.MIN_VALUE - 1) + ".");
        else
            output.writeLong(l.longValue());
    }
View Full Code Here

    private void writeFloat32(DataOutputStream output, Float f) throws IOException {
        if(f == null)
            output.writeFloat(Float.MIN_VALUE);
        else if(f.floatValue() == Float.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Float.MIN_VALUE
                                             + " in float32, but that value is reserved for null.");
        else
            output.writeFloat(f.floatValue());
    }
View Full Code Here

    private void writeFloat64(DataOutputStream output, Double d) throws IOException {
        if(d == null)
            output.writeDouble(Double.MIN_VALUE);
        else if(d.doubleValue() == Double.MIN_VALUE)
            throw new SerializationException("Underflow: attempt to store " + Double.MIN_VALUE
                                             + " in float64, but that value is reserved for null.");
        else
            output.writeDouble(d.doubleValue());
    }
View Full Code Here

        else if(o instanceof Date)
            return (Date) o;
        else if(o instanceof Number)
            return new Date(((Number) o).longValue());
        else
            throw new SerializationException("Object of type " + o.getClass()
                                             + " can not be coerced to type " + JsonTypes.DATE);
    }
View Full Code Here

TOP

Related Classes of voldemort.serialization.SerializationException

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.