Package voldemort.serialization

Examples of voldemort.serialization.SerializationException


            this.contextBuffer[this.contextOffset] = (char) this.current;
            this.contextOffset = (contextOffset + 1) % this.contextBuffer.length;

            return this.current;
        } catch(IOException e) {
            throw new SerializationException("Error reading from JSON stream.", e);
        }
    }
View Full Code Here


            next();
    }

    private void skip(int c) {
        if(current() != c)
            throw new SerializationException("Expected '" + ((char) c)
                                             + "' but current character is '" + currentChar()
                                             + "' on line " + line + " character " + lineOffset
                                             + ": " + getCurrentContext());
        next();
    }
View Full Code Here

                newM.put(key, fromJsonObjects(m.get(key)));
            return newM;
        } else if(o instanceof List) {
            List<?> l = (List<?>) o;
            if(l.size() != 1)
                throw new SerializationException("List type must have a single entry specifying entry type.");
            List<Object> newL = new ArrayList<Object>(1);
            newL.add(fromJsonObjects(l.get(0)));
            return newL;
        } else if(o instanceof String) {
            return JsonTypes.fromDisplay((String) o);
        } else {
            throw new SerializationException(o + " is not a string, an array, or an object, "
                                             + "so it is not valid in a type definition.");
        }
    }
View Full Code Here

                    b.append(", ");
                i++;
            }
            b.append('}');
        } else {
            throw new SerializationException("Current type is " + type + " of class "
                                             + type.getClass() + " which is not allowed.");
        }

        return b.toString();
    }
View Full Code Here

        MemoryBuffer buffer = new MemoryBuffer();
        TProtocol protocol = createThriftProtocol(buffer);
        try {
            object.write(protocol);
        } catch(TException e) {
            throw new SerializationException(e);
        }
        return buffer.toByteArray();
    }
View Full Code Here

    public T toObject(byte[] bytes) {
        MemoryBuffer buffer = new MemoryBuffer();
        try {
            buffer.write(bytes);
        } catch(TTransportException e) {
            throw new SerializationException(e);
        }
        TProtocol protocol = createThriftProtocol(buffer);

        T msg = null;
        try {
            msg = messageClass.newInstance();
            msg.read(protocol);
        } catch(InstantiationException e) {
            throw new SerializationException(e);
        } catch(IllegalAccessException e) {
            throw new SerializationException(e);
        } catch(TException e) {
            throw new SerializationException(e);
        }

        return msg;
    }
View Full Code Here

        if(this.config.isEnableSerializationLayer()) {
            Serializer<K> keySerializer = (Serializer<K>) serializerFactory.getSerializer(storeDef.getKeySerializer());
            Serializer<V> valueSerializer = (Serializer<V>) serializerFactory.getSerializer(storeDef.getValueSerializer());

            if(storeDef.isView() && (storeDef.getTransformsSerializer() == null))
                throw new SerializationException("Transforms serializer must be specified with a view ");

            Serializer<T> transformsSerializer = (Serializer<T>) serializerFactory.getSerializer(storeDef.getTransformsSerializer() != null ? storeDef.getTransformsSerializer()
                                                                                                                                           : new SerializerDefinition("identity"));

            finalStore = SerializingStore.wrap(store,
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.