Examples of asReadOnlyBuffer()


Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    }
    buffer.put(bytes);
    buffer.position(offset);
    buffer.limit(offset + len);
    if (randomBoolean()) {
      buffer = buffer.asReadOnlyBuffer();
    }
    return buffer;
  }

}
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

        } else {
            try {
                ByteBuffer msg =
                    ByteBuffer.wrap(
                        new byte[] { SimpleSgsProtocol.LOGOUT_REQUEST });
                sendRaw(msg.asReadOnlyBuffer());
            } catch (IOException e) {
                logger.logThrow(Level.FINE, e, "During graceful logout:");
                try {
                    loggedIn = false;
                    clientConnection.disconnect();
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

            logger.log(Level.FINEST, "Direct receive");
            checkLoggedIn();
            byte[] msgBytes = msg.getBytes(msg.limit() - msg.position());
            ByteBuffer buf = ByteBuffer.wrap(msgBytes);
            try {
                clientListener.receivedMessage(buf.asReadOnlyBuffer());
            } catch (RuntimeException e) {
                if (logger.isLoggable(Level.WARNING)) {
                    logger.logThrow(
                            Level.WARNING, e,
                            "SimpleClientListener.receivedMessage callback " +
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

                           channelId);
                return;
            }
            byte[] msgBytes = msg.getBytes(msg.limit() - msg.position());
            ByteBuffer buf = ByteBuffer.wrap(msgBytes);
            channel.receivedMessage(buf.asReadOnlyBuffer());
        }

        /**
         * {@inheritDoc}
         */
 
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    public void test_read_LByteBuffer_readOnlyBuf() throws Exception {
        // regression test for Harmony-754
        ByteBuffer c = ByteBuffer.allocate(1);
        DatagramChannel channel = DatagramChannel.open();
        try{
            channel.read(c.asReadOnlyBuffer());
            fail("Should throw NotYetConnectedException");
        } catch (NotYetConnectedException e){
            // expected
        }
        channel.connect(localAddr1);
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

        } catch (NotYetConnectedException e){
            // expected
        }
        channel.connect(localAddr1);
        try{
            channel.read(c.asReadOnlyBuffer());
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e){
            // expected
        }
    }
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    final int sizePosition = initialOffset + offsetFromInitial + HEADER_NUM_BYTES + 2 * numDims * Floats.BYTES;
    int numBytes = data.getInt(sizePosition);
    data.position(sizePosition + Ints.BYTES);
    ByteBuffer tmpBuffer = data.slice();
    tmpBuffer.limit(numBytes);
    return bitmapFactory.mapImmutableBitmap(tmpBuffer.asReadOnlyBuffer());
  }

  public Iterable<ImmutableNode> getChildren()
  {
    return new Iterable<ImmutableNode>()
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    buffer.put(VERSION);
    buffer.putInt(rTree.getNumDims());
    rTree.getRoot().storeInByteBuffer(buffer, buffer.position());
    buffer.position(0);
    return new ImmutableRTree(buffer.asReadOnlyBuffer(), rTree.getBitmapFactory());
  }

  private static int calcNumBytes(RTree tree)
  {
    int total = 1 + Ints.BYTES; // VERSION and numDims
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

    public void test_read_LByteBuffer_readOnlyBuf() throws Exception {
        // regression test for Harmony-754
        ByteBuffer c = ByteBuffer.allocate(1);
        DatagramChannel channel = DatagramChannel.open();
        try{
            channel.read(c.asReadOnlyBuffer());
            fail("Should throw NotYetConnectedException");
        } catch (NotYetConnectedException e){
            // expected
        }
        channel.connect(localAddr1);
View Full Code Here

Examples of java.nio.ByteBuffer.asReadOnlyBuffer()

        } catch (NotYetConnectedException e){
            // expected
        }
        channel.connect(localAddr1);
        try{
            channel.read(c.asReadOnlyBuffer());
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e){
            // expected
        }
    }
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.