Package org.msgpack

Examples of org.msgpack.MessageTypeException


    private BigIntegerTemplate() { }

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


    private ShortArrayTemplate() { }

    public void write(Packer pk, short[] 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 BooleanTemplate() { }

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

    @Override
    public void write(Packer packer, Object v, boolean required)
      throws IOException {
  if (v == null) {
      if (required) {
    throw new MessageTypeException("Attempted to write null");
      }
      packer.writeNil();
      return;
  }
  if (!(v instanceof Object[]) || !componentClass.isAssignableFrom(v.getClass().getComponentType())) {
      throw new MessageTypeException();
  }

  Object[] array = (Object[]) v;
  int length = array.length;
  packer.writeArrayBegin(length);
View Full Code Here

    private ShortTemplate() { }

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

            }
        default:
            //System.out.println("unknown b "+(b&0xff));
            // headByte = CS_INVALID
            headByte = REQUIRE_TO_READ_HEAD;
            throw new MessageTypeException("Invalid byte: "+b)// TODO error
        }
    }
View Full Code Here

    private DoubleTemplate() { }

    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.writeDouble(target);
View Full Code Here

        if(b == 0xc0) {
            stack.reduceCount();
            headByte = REQUIRE_TO_READ_HEAD;
            return;
        }
        throw new MessageTypeException("Expected nil but got not nil value");
    }
View Full Code Here

        } else if(b == 0xc3) {
            stack.reduceCount();
            headByte = REQUIRE_TO_READ_HEAD;
            return true;
        }
        throw new MessageTypeException("Expected Boolean but got not boolean value");
    }
View Full Code Here

        // optimized not to allocate byteAccept
        stack.checkCount();
        readOneWithoutStack(intAccept);
        int value = intAccept.value;
        if(value < (int)Byte.MIN_VALUE || value > (int)Byte.MAX_VALUE) {
            throw new MessageTypeException()// TODO message
        }
        stack.reduceCount();
        return (byte)value;
    }
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.