Package org.terasology.persistence.typeHandling

Examples of org.terasology.persistence.typeHandling.DeserializationException


    @Override
    public ByteBuffer getAsByteBuffer() {
        if (data.hasBytes()) {
            return data.getBytes().asReadOnlyByteBuffer();
        } else if (!isNull()) {
            throw new DeserializationException("Data is not bytes");
        } else {
            return ByteBuffer.wrap(new byte[0]);
        }
    }
View Full Code Here


    public <T> T deserializeAs(PersistedData data, Class<T> type) {
        GsonPersistedData gsonData = (GsonPersistedData) data;
        try {
            return context.deserialize(gsonData.getElement(), type);
        } catch (JsonParseException jpe) {
            throw new DeserializationException("Failed to deserialize data as " + type, jpe);
        }
    }
View Full Code Here

    }

    @Override
    public final byte[] getAsBytes() {
        if (!isBytes()) {
            throw new DeserializationException("Data is not a valid bytes array");
        } else {
            return cachedDecodedBytes;
        }
    }
View Full Code Here

        throw new ClassCastException("Data is not a boolean");
    }

    @Override
    public byte[] getAsBytes() {
        throw new DeserializationException("Data is not bytes");
    }
View Full Code Here

        throw new DeserializationException("Data is not bytes");
    }

    @Override
    public ByteBuffer getAsByteBuffer() {
        throw new DeserializationException("Data is not bytes");
    }
View Full Code Here

    @Override
    public byte[] getAsBytes() {
        if (data.hasBytes()) {
            return data.getBytes().toByteArray();
        } else if (!isNull()) {
            throw new DeserializationException("Data is not bytes");
        } else {
            return new byte[0];
        }
    }
View Full Code Here

TOP

Related Classes of org.terasology.persistence.typeHandling.DeserializationException

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.