Package org.msgpack

Examples of org.msgpack.MessageTypeException


    }

    public void write(Packer pk, Collection<E> target, boolean required) throws IOException {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        Collection<E> col = target;
View Full Code Here


    }

    @Override
    void acceptUnsignedInteger(long v) {
        if(v < 0L) {
            throw new MessageTypeException()// TODO message
        }
        this.value = v;
    }
View Full Code Here

    }

    @Override
    public void writeArrayEnd(boolean check) {
        if(!stack.topIsArray()) {
            throw new MessageTypeException("writeArrayEnd() is called but writeArrayBegin() is not called");
        }

        int remain = stack.getTopCount();
        if(remain > 0) {
            if(check) {
                throw new MessageTypeException("writeArrayEnd(check=true) is called but the array is not end");
            }
            for(int i=0; i < remain; i++) {
                writeNil();
            }
        }
View Full Code Here

    }

    @Override
    public void writeMapEnd(boolean check) {
        if(!stack.topIsMap()) {
            throw new MessageTypeException("writeMapEnd() is called but writeMapBegin() is not called");
        }

        int remain = stack.getTopCount();
        if(remain > 0) {
            if(check) {
                throw new MessageTypeException("writeMapEnd(check=true) is called but the map is not end");
            }
            for(int i=0; i < remain; i++) {
                writeNil();
            }
        }
View Full Code Here

    private DoubleArrayTemplate() { }

    public void write(Packer pk, double[] target, boolean required) throws IOException {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        pk.writeArrayBegin(target.length);
View Full Code Here

    private FloatTemplate() { }

    public void write(Packer pk, Float target, boolean required) throws IOException {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        pk.writeFloat(target);
View Full Code Here

    }

    @Override
    void acceptInteger(long v) {
        if(value < (long)Integer.MIN_VALUE || value > (long)Integer.MAX_VALUE) {
            throw new MessageTypeException()// TODO message
        }
        this.value = (int)v;
    }
View Full Code Here

    }

    @Override
    void acceptUnsignedInteger(int v) {
        if(v < 0) {
            throw new MessageTypeException()// TODO message
        }
        this.value = v;
    }
View Full Code Here

    }

    @Override
    void acceptUnsignedInteger(long v) {
        if(v < 0 || v > (long)Integer.MAX_VALUE) {
            throw new MessageTypeException()// TODO message
        }
        this.value = (int)v;
    }
View Full Code Here

    public void write(Packer pk, Map<K,V> target, boolean required) throws IOException {
        if (!(target instanceof Map)) {
            if (target == null) {
                if (required) {
                    throw new MessageTypeException("Attempted to write null");
                }
                pk.writeNil();
                return;
            }
            throw new MessageTypeException("Target is not a Map but "+target.getClass());
        }
        Map<K,V> map = (Map<K,V>) target;
        pk.writeMapBegin(map.size());
        for (Map.Entry<K,V> pair : map.entrySet()) {
            keyTemplate.write(pk, pair.getKey());
View Full Code Here

TOP

Related Classes of org.msgpack.MessageTypeException

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.