Examples of writable()


Examples of com.peterhi.runtime.Buffer.writable()

      byte[] existingData = new byte[] { -1, -1 };
      Buffer existingDataOffsetLengthBitsNotAligned = new Buffer(existingData, 4, 10, false);
      assertEquals(2, existingDataOffsetLengthBitsNotAligned.size());
      assertEquals(14, existingDataOffsetLengthBitsNotAligned.readable());
      assertEquals(14, existingDataOffsetLengthBitsNotAligned.written());
      assertEquals(2, existingDataOffsetLengthBitsNotAligned.writable());
      assertEquals(0, existingDataOffsetLengthBitsNotAligned.read());
      existingDataOffsetLengthBitsNotAligned.skip(3);
      assertEquals(1, existingDataOffsetLengthBitsNotAligned.read());
      existingDataOffsetLengthBitsNotAligned.skip(9);
      assertEquals(-1, existingDataOffsetLengthBitsNotAligned.read());
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

      byte[] existingData = new byte[] { -1, -1 };
      Buffer existingDataOffsetLengthBitsAligned = new Buffer(existingData, 4, 9, true);
      assertEquals(2, existingDataOffsetLengthBitsAligned.size());
      assertEquals(9, existingDataOffsetLengthBitsAligned.readable());
      assertEquals(9, existingDataOffsetLengthBitsAligned.written());
      assertEquals(7, existingDataOffsetLengthBitsAligned.writable());
      assertEquals(1, existingDataOffsetLengthBitsAligned.read());
      existingDataOffsetLengthBitsAligned.skip(7);
      assertEquals(1, existingDataOffsetLengthBitsAligned.read());
      assertEquals(-1, existingDataOffsetLengthBitsAligned.read());
    }
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

 
  @Test
  public void testSizeFunctions() throws Exception {
    Buffer testBuffer = new Buffer(1);
    assertEquals(0, testBuffer.readable());
    assertEquals(Byte.SIZE, testBuffer.writable());
    assertEquals(0, testBuffer.written());
    assertEquals(1, testBuffer.size());
  }
 
  @Test
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

    assertEquals(1, readWriteBuffer.read());
    assertEquals(0, readWriteBuffer.read());
    assertEquals(1, readWriteBuffer.read());
    assertEquals(-1, readWriteBuffer.read());
    assertEquals(Buffer.CAPACITY_DEFAULT, readWriteBuffer.size());
    assertEquals(Byte.SIZE * Buffer.CAPACITY_DEFAULT - 3, readWriteBuffer.writable());
    assertEquals(0, readWriteBuffer.readable());
    assertEquals(3, readWriteBuffer.written());
  }
 
  @Test
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

    assertEquals(true, readWriteBuffer.readAsBoolean());
    assertEquals(false, readWriteBuffer.readAsBoolean());
    assertEquals(true, readWriteBuffer.readAsBoolean());
    assertEquals(-1, readWriteBuffer.read());
    assertEquals(Buffer.CAPACITY_DEFAULT, readWriteBuffer.size());
    assertEquals(Byte.SIZE * Buffer.CAPACITY_DEFAULT - 3, readWriteBuffer.writable());
    assertEquals(0, readWriteBuffer.readable());
    assertEquals(3, readWriteBuffer.written());
  }
 
  @Test
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

  public void testConstructors() throws Exception {
    {
      Buffer capacityInBytes = new Buffer(Buffer.CAPACITY_DEFAULT);
      assertEquals(Buffer.CAPACITY_DEFAULT, capacityInBytes.size());
      assertEquals(0, capacityInBytes.readable());
      assertEquals(Byte.SIZE * Buffer.CAPACITY_DEFAULT, capacityInBytes.writable());
      assertEquals(0, capacityInBytes.written());
    }
   
    try {
      Buffer negativeCapacityInBytes = new Buffer(-1);
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

   
    {
      Buffer defaultConstructor = new Buffer();
      assertEquals(Buffer.CAPACITY_DEFAULT, defaultConstructor.size());
      assertEquals(0, defaultConstructor.readable());
      assertEquals(Byte.SIZE * Buffer.CAPACITY_DEFAULT, defaultConstructor.writable());
      assertEquals(0, defaultConstructor.written());
    }
   
    {
      byte[] existingData = new byte[32];
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

    {
      byte[] existingData = new byte[32];
      Buffer usingExistingData = new Buffer(existingData);
      assertEquals(existingData.length, usingExistingData.size());
      assertEquals(Byte.SIZE * existingData.length, usingExistingData.readable());
      assertEquals(0, usingExistingData.writable());
      assertEquals(Byte.SIZE * existingData.length, usingExistingData.written());
    }
   
    try {
      Buffer usingNullExistingData = new Buffer(null);
View Full Code Here

Examples of com.peterhi.runtime.Buffer.writable()

      byte[] existingData = new byte[32];
      Buffer existingDataOffsetLength = new Buffer(existingData, 0, existingData.length);
      assertEquals(existingData.length, existingDataOffsetLength.size());
      assertEquals(existingData.length, existingDataOffsetLength.size());
      assertEquals(Byte.SIZE * existingData.length, existingDataOffsetLength.readable());
      assertEquals(0, existingDataOffsetLength.writable());
      assertEquals(Byte.SIZE * existingData.length, existingDataOffsetLength.written());
    }
   
    try {
      Buffer nullDataOffsetLength = new Buffer(null, 0, 1);
View Full Code Here

Examples of org.infinispan.jmx.annotations.ManagedAttribute.writable()

            ManagedAttribute attr = field.getAnnotation(ManagedAttribute.class);
            if (attr != null) {
               String fieldName = renameToJavaCodingConvention(field.getName());
               MBeanAttributeInfo info = new MBeanAttributeInfo(fieldName, field.getType()
                        .getCanonicalName(), attr.description(), true, Modifier.isFinal(field
                        .getModifiers()) ? false : attr.writable(), false);

               atts.put(fieldName, new FieldAttributeEntry(info, field));
            }
         }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.