Examples of asReadOnlyBuffer()


Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    public void testWriteToBufferExceptionReadOnlyBuffer() {

        final ByteBuffer buffer = ByteBuffer.allocate(7
                                                      + 2 * info.missingSourceSymbols().size()
                                                      + 3 * info.availableRepairSymbols().size());
        info.writeTo(buffer.asReadOnlyBuffer());
    }

    @Test(expected = BufferOverflowException.class)
    public void testWriteToBufferExceptionBufferOverflow() {

View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

        if (collector == null) {
          return new byte[]{};
        }
        ByteBuffer val = collector.toByteBuffer();
        byte[] retVal = new byte[val.remaining()];
        val.asReadOnlyBuffer().get(retVal);
        return retVal;
      }

      @Override
      public int compare(HyperLogLogCollector o1, HyperLogLogCollector o2)
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

  public static IntBufferIndexedInts fromArray(int[] array)
  {
    final ByteBuffer buffer = ByteBuffer.allocate(array.length * Ints.BYTES);
    buffer.asIntBuffer().put(array);

    return new IntBufferIndexedInts(buffer.asReadOnlyBuffer());
  }

  public static IntBufferIndexedInts fromIntList(IntList intList)
  {
    final ByteBuffer buffer = ByteBuffer.allocate(intList.length() * Ints.BYTES);
 
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

            skippedDimensions.add(dimension);
            continue;
          }

          VSizeIndexedInts singleValCol = null;
          VSizeIndexed multiValCol = VSizeIndexed.readFromByteBuffer(dimBuffer.asReadOnlyBuffer());
          GenericIndexed<ImmutableBitmap> bitmaps = bitmapIndexes.get(dimension);
          ImmutableRTree spatialIndex = spatialIndexes.get(dimension);

          final BitmapFactory bitmapFactory = bitmapSerdeFactory.getBitmapFactory();
          boolean onlyOneValue = true;
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    for (int i = 0; i < intList.length(); ++i) {
      intBuf.put(intList.get(i));
    }

    return new IntBufferIndexedInts(buffer.asReadOnlyBuffer());
  }

  private final ByteBuffer buffer;

  public IntBufferIndexedInts(ByteBuffer buffer)
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

          retVal.putShort((short) (0xffff & (i - initPosition)));
          retVal.put(storageBuffer.get(i));
        }
      }
      retVal.rewind();
      return retVal.asReadOnlyBuffer();
    }

    return storageBuffer.asReadOnlyBuffer();
  }
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    ByteBuffer theBuffer = ByteBuffer.allocate(headerBytes.size() + valueBytes.size());
    theBuffer.put(headerBytes.toByteArray());
    theBuffer.put(valueBytes.toByteArray());
    theBuffer.flip();

    return new VSizeIndexed(theBuffer.asReadOnlyBuffer(), numBytes);
  }

  private final ByteBuffer theBuffer;
  private final int numBytes;
  private final int size;
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    biggerOffset.put(initialBytes);
    while (biggerOffset.hasRemaining()) {
      biggerOffset.put((byte) remainingBytes);
    }
    biggerOffset.clear();
    return biggerOffset.asReadOnlyBuffer();
  }

  private short computeNumNonZero(byte theByte)
  {
    short retVal = 0;
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    ByteBuffer theBuffer = ByteBuffer.allocate(headerBytes.size() + valueBytes.size());
    theBuffer.put(headerBytes.toByteArray());
    theBuffer.put(valueBytes.toByteArray());
    theBuffer.flip();

    return new GenericIndexed<T>(theBuffer.asReadOnlyBuffer(), strategy, allowReverseLookup);
  }

  private static class SizedLRUMap<K, V> extends LinkedHashMap<K, Pair<Integer, V>>
  {
    private final int maxBytes;
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    @Test(expected = ReadOnlyBufferException.class)
    public void testWriteToBufferExceptionReadOnlyBuffer() {

        final ByteBuffer buffer = ByteBuffer.allocate(12);
        PARAMS.writeTo(buffer.asReadOnlyBuffer());
    }

    @Test(expected = BufferOverflowException.class)
    public void testWriteToBufferExceptionBufferOverflow() {
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.