Package com.peterhi

Examples of com.peterhi.uintx


      } else if (type == IntegerX.Signed.class) {
        writeRecursively(desc, intx.class,
          new intx((IntegerX.Signed )value), lookup);
      } else if (type == IntegerX.Unsigned.class) {
        writeRecursively(desc, uintx.class,
          new uintx((IntegerX.Unsigned )value), lookup);
      } else {
        throw new IllegalArgumentException(MessageFormat.format(
          "Unsupported type \"{0}\".", type));
      }
    }
View Full Code Here


        "Unsupported type \"{0}\".", type));
    }
  }

  private boolean writeSize(int size, boolean nullable) throws IOException {
    uintx u = new uintx(size + (nullable ? 1 : 0));
    write(u.toByteArray());
    return nullable ? (size != -1) : true;
   
  }
View Full Code Here

    } else if (type == int24.class) {
      return new int24(this);
    } else if (type == intx.class) {
      return new intx(this);
    } else if (type == uintx.class) {
      return new uintx(this);
    } else if (type == Boolean.class) {
      int b = readByte();
      return (b == -1) ? null : (b != 0);
    } else if (type == boolean[].class) {
      int size = readSize(true);
View Full Code Here

      fillElements(desc, element, lookup);
    }
  }
 
  private int readSize(boolean nullable) throws IOException {
    uintx u = new uintx(this);
    return u.intValue() - (nullable ? 1 : 0);
  }
View Full Code Here

    PropUtil.setValue(p0, "int24Value",
      new int24(int24.MIN_24));
    PropUtil.setValue(p0, "intxValue",
      new intx(intx.MIN_62));
    PropUtil.setValue(p0, "uintxValue",
      new uintx(uintx.MAX_62));
   
    Assert.assertEquals(Boolean.TRUE,
      PropUtil.getValue(p0, "booleanValue"));
    Assert.assertEquals((byte )-1,
      PropUtil.getValue(p0, "byteValue"));
    Assert.assertEquals('c',
      PropUtil.getValue(p0, "charValue"));
    Assert.assertEquals((short )-1,
      PropUtil.getValue(p0, "shortValue"));
    Assert.assertEquals(-1,
      PropUtil.getValue(p0, "intValue"));
    Assert.assertEquals(-1L,
      PropUtil.getValue(p0, "longValue"));
    Assert.assertEquals(-1.0f,
      PropUtil.getValue(p0, "floatValue"));
    Assert.assertEquals(-1.0,
      PropUtil.getValue(p0, "doubleValue"));
    Assert.assertEquals(new int24(int24.MIN_24),
      PropUtil.getValue(p0, "int24Value"));
    Assert.assertEquals(new intx(intx.MIN_62),
      PropUtil.getValue(p0, "intxValue"));
    Assert.assertEquals(new uintx(uintx.MAX_62),
      PropUtil.getValue(p0, "uintxValue"));
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PmOutputStream pos = new PmOutputStream(baos);
    pos.writeModel(p0);
View Full Code Here

TOP

Related Classes of com.peterhi.uintx

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.