/libcore/ojluni/src/main/java/java/nio/ |
D | Bits.java | 71 static char getCharL(ByteBuffer bb, int bi) { in getCharL() argument 72 return makeChar(bb._get(bi + 1), in getCharL() 73 bb._get(bi )); in getCharL() 81 static char getCharB(ByteBuffer bb, int bi) { in getCharB() argument 82 return makeChar(bb._get(bi ), in getCharB() 83 bb._get(bi + 1)); in getCharB() 91 static char getChar(ByteBuffer bb, int bi, boolean bigEndian) { in getChar() argument 92 return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi); in getChar() 102 static void putCharL(ByteBuffer bb, int bi, char x) { in putCharL() argument 103 bb._put(bi , char0(x)); in putCharL() [all …]
|
D | ByteBufferAsDoubleBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsDoubleBuffer 54 ByteBufferAsDoubleBuffer(ByteBuffer bb, in ByteBufferAsDoubleBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsDoubleBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsDoubleBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsDoubleBuffer() 75 this.address = bb.address + off; in ByteBufferAsDoubleBuffer() 77 this.bb.order(order); in ByteBufferAsDoubleBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsDoubleBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsDoubleBuffer(bb, in slice() [all …]
|
D | ByteBufferAsLongBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsLongBuffer 54 ByteBufferAsLongBuffer(ByteBuffer bb, in ByteBufferAsLongBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsLongBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsLongBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsLongBuffer() 75 this.address = bb.address + off; in ByteBufferAsLongBuffer() 77 this.bb.order(order); in ByteBufferAsLongBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsLongBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsLongBuffer(bb, in slice() [all …]
|
D | ByteBufferAsIntBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsIntBuffer 54 ByteBufferAsIntBuffer(ByteBuffer bb, in ByteBufferAsIntBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsIntBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsIntBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsIntBuffer() 75 this.address = bb.address + off; in ByteBufferAsIntBuffer() 77 this.bb.order(order); in ByteBufferAsIntBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsIntBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsIntBuffer(bb, in slice() [all …]
|
D | ByteBufferAsShortBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsShortBuffer 54 ByteBufferAsShortBuffer(ByteBuffer bb, in ByteBufferAsShortBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsShortBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsShortBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsShortBuffer() 75 this.address = bb.address + off; in ByteBufferAsShortBuffer() 77 this.bb.order(order); in ByteBufferAsShortBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsShortBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsShortBuffer(bb, in slice() [all …]
|
D | ByteBufferAsFloatBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsFloatBuffer 54 ByteBufferAsFloatBuffer(ByteBuffer bb, in ByteBufferAsFloatBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsFloatBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsFloatBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsFloatBuffer() 75 this.address = bb.address + off; in ByteBufferAsFloatBuffer() 77 this.bb.order(order); in ByteBufferAsFloatBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsFloatBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsFloatBuffer(bb, in slice() [all …]
|
D | ByteBufferAsCharBuffer.java | 41 protected final ByteBuffer bb; field in ByteBufferAsCharBuffer 54 ByteBufferAsCharBuffer(ByteBuffer bb, in ByteBufferAsCharBuffer() argument 65 this.bb = bb.duplicate(); in ByteBufferAsCharBuffer() 66 this.isReadOnly = bb.isReadOnly; in ByteBufferAsCharBuffer() 74 if (bb instanceof DirectByteBuffer) { in ByteBufferAsCharBuffer() 75 this.address = bb.address + off; in ByteBufferAsCharBuffer() 77 this.bb.order(order); in ByteBufferAsCharBuffer() 89 return bb.base(); in base() 100 return new ByteBufferAsCharBuffer(bb, -1, 0, rem, rem, ix(pos), order); in slice() 106 return new ByteBufferAsCharBuffer(bb, in slice() [all …]
|
D | ByteBufferAs-X-Buffer.java.template | 41 protected final ByteBuffer bb; 46 * The offset from the Bytebuffer at the position 0 (in addition to bb.offset) in the 54 ByteBufferAs$Type$Buffer(ByteBuffer bb, 61 // this.bb = bb; 63 // assert address >= bb.address; 65 this.bb = bb.duplicate(); 66 this.isReadOnly = bb.isReadOnly; 67 … // There are only two possibilities for the type of ByteBuffer "bb", viz, DirectByteBuffer and 68 // HeapByteBuffer. We only have to initialize the field when bb is an instance of 74 if (bb instanceof DirectByteBuffer) { [all …]
|
/libcore/ojluni/src/test/java/nio/Buffer/ |
D | ByteBufferViews.java | 109 (ByteBuffer bb) -> bb.order(ByteOrder.BIG_ENDIAN)), 111 (ByteBuffer bb) -> bb.order(ByteOrder.LITTLE_ENDIAN)) 144 static void assertValues(int i, Object bValue, Object bbValue, ByteBuffer bb) { in assertValues() argument 147 bValue, bbValue, i, bb)); in assertValues() 151 static void assertValues(int i, Object bbValue, Object bvValue, ByteBuffer bb, Buffer bv) { in assertValues() argument 154 bbValue, bvValue, i, bb, bv)); in assertValues() 166 static ByteBuffer fill(ByteBuffer bb, IntUnaryOperator o) { in fill() argument 167 for (int i = 0; i < bb.limit(); i++) { in fill() 168 bb.put(i, (byte) o.applyAsInt(i)); in fill() 170 return bb; in fill() [all …]
|
D | Order.java | 47 private static void ckViews(ByteBuffer bb) { in ckViews() argument 48 ck(bb.asCharBuffer().order(), bb.order()); in ckViews() 49 ck(bb.asShortBuffer().order(), bb.order()); in ckViews() 50 ck(bb.asIntBuffer().order(), bb.order()); in ckViews() 51 ck(bb.asLongBuffer().order(), bb.order()); in ckViews() 52 ck(bb.asFloatBuffer().order(), bb.order()); in ckViews() 53 ck(bb.asDoubleBuffer().order(), bb.order()); in ckViews() 56 private static void ckCopyViews(ByteBuffer bb) { in ckCopyViews() argument 57 ck(bb.asReadOnlyBuffer().order(), be); in ckCopyViews() 58 ck(bb.duplicate().order(), be); in ckCopyViews() [all …]
|
D | AllocateDirectInit.java | 40 ByteBuffer bb = ByteBuffer.allocateDirect(1024); in testAllocate() local 42 for (bb.position(0); bb.position() < bb.limit(); ) { in testAllocate() 43 if ((bb.get() & 0xff) != 0) in testAllocate() 45 + bb.position()); in testAllocate() 50 private static void printByteBuffer(ByteBuffer bb) { in printByteBuffer() argument 52 for (bb.position(0); bb.position() < bb.limit(); ) in printByteBuffer() 53 System.out.print(" " + Integer.toHexString(bb.get() & 0xff)); in printByteBuffer()
|
D | Basic.java | 89 ByteBuffer bb = (ByteBuffer)b; in fail() local 90 int n = Math.min(16, bb.limit()); in fail() 92 out.print(" " + Integer.toHexString(bb.get(i) & 0xff)); in fail() 96 CharBuffer bb = (CharBuffer)b; in fail() local 97 int n = Math.min(16, bb.limit()); in fail() 99 out.print(" " + Integer.toHexString(bb.get(i) & 0xffff)); in fail()
|
/libcore/luni/src/test/java/libcore/java/nio/charset/ |
D | CharsetEncoderTest.java | 71 ByteBuffer bb = ByteBuffer.allocate(128); in testSurrogatePairAllAtOnce() local 72 CoderResult cr = e.encode(CharBuffer.wrap(new char[] { '\ud842', '\udf9f' }), bb, false); in testSurrogatePairAllAtOnce() 74 assertEquals(4, bb.position()); in testSurrogatePairAllAtOnce() 75 assertEquals((byte) 0x00, bb.get(0)); in testSurrogatePairAllAtOnce() 76 assertEquals((byte) 0x02, bb.get(1)); in testSurrogatePairAllAtOnce() 77 assertEquals((byte) 0x0b, bb.get(2)); in testSurrogatePairAllAtOnce() 78 assertEquals((byte) 0x9f, bb.get(3)); in testSurrogatePairAllAtOnce() 85 ByteBuffer bb = ByteBuffer.allocate(128); in testMalformedSurrogatePair() local 86 CoderResult cr = e.encode(CharBuffer.wrap(new char[] { '\udf9f' }), bb, false); in testMalformedSurrogatePair() 122 ByteBuffer bb = ByteBuffer.allocate(128); in testCharsetEncoderSplitSurrogates() local [all …]
|
/libcore/ojluni/src/test/java/util/zip/ |
D | ChecksumBase.java | 70 ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789); in testWrappedByteBuffer() local 71 checksum.update(bb); in testWrappedByteBuffer() 77 ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789).asReadOnlyBuffer(); in testReadonlyByteBuffer() local 78 checksum.update(bb); in testReadonlyByteBuffer() 84 ByteBuffer bb = ByteBuffer.allocateDirect(BYTES_123456789.length); in testDirectByteBuffer() local 85 bb.put(BYTES_123456789); in testDirectByteBuffer() 86 bb.rewind(); in testDirectByteBuffer() 87 checksum.update(bb); in testDirectByteBuffer() 113 ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length); in testDirectByteBufferOffset() local 115 bb.put(unaligned_bytes_123456789); in testDirectByteBufferOffset() [all …]
|
/libcore/ojluni/src/main/java/java/nio/channels/ |
D | Channels.java | 71 private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb) in writeFullyImpl() argument 74 while (bb.remaining() > 0) { in writeFullyImpl() 75 int n = ch.write(bb); in writeFullyImpl() 87 private static void writeFully(WritableByteChannel ch, ByteBuffer bb) in writeFully() argument 95 writeFullyImpl(ch, bb); in writeFully() 98 writeFullyImpl(ch, bb); in writeFully() 144 private ByteBuffer bb; in newOutputStream() 166 ByteBuffer bb = ((this.bs == bs) in newOutputStream() local 167 ? this.bb in newOutputStream() 169 bb.limit(Math.min(off + len, bb.capacity())); in newOutputStream() [all …]
|
/libcore/ojluni/src/main/java/sun/nio/ch/ |
D | ChannelInputStream.java | 48 public static int read(ReadableByteChannel ch, ByteBuffer bb, in read() argument 60 int n = ch.read(bb); in read() 66 return ch.read(bb); in read() 71 private ByteBuffer bb = null; field in ChannelInputStream 95 ByteBuffer bb = ((this.bs == bs) in read() 96 ? this.bb in read() 98 bb.limit(Math.min(off + len, bb.capacity())); in read() 99 bb.position(off); in read() 100 this.bb = bb; in read() 102 return read(bb); in read() [all …]
|
D | IOUtil.java | 58 ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); in write() local 60 bb.put(src); in write() 61 bb.flip(); in write() 65 int n = writeFromNativeBuffer(fd, bb, position, nd); in write() 72 Util.offerFirstTemporaryDirectBuffer(bb); in write() 76 private static int writeFromNativeBuffer(FileDescriptor fd, ByteBuffer bb, in writeFromNativeBuffer() argument 80 int pos = bb.position(); in writeFromNativeBuffer() 81 int lim = bb.limit(); in writeFromNativeBuffer() 90 ((DirectBuffer)bb).address() + pos, in writeFromNativeBuffer() 93 written = nd.write(fd, ((DirectBuffer)bb).address() + pos, rem); in writeFromNativeBuffer() [all …]
|
D | DatagramSocketAdaptor.java | 145 ByteBuffer bb = ByteBuffer.wrap(p.getData(), in send() local 156 dc.write(bb); in send() 159 dc.send(bb, p.getSocketAddress()); in send() 163 dc.send(bb, p.getSocketAddress()); in send() 174 private SocketAddress receive(ByteBuffer bb) throws IOException { in receive() argument 176 return dc.receive(bb); in receive() 183 if ((sender = dc.receive(bb)) != null) in receive() 193 if ((sender = dc.receive(bb)) != null) in receive() 213 ByteBuffer bb = ByteBuffer.wrap(p.getData(), in receive() local 216 SocketAddress sender = receive(bb); in receive() [all …]
|
/libcore/ojluni/src/main/java/sun/nio/cs/ |
D | StreamEncoder.java | 175 private ByteBuffer bb; field in StreamEncoder 204 bb = ByteBuffer.allocateDirect(DEFAULT_BYTE_BUFFER_SIZE); in StreamEncoder() 207 bb = ByteBuffer.allocate(DEFAULT_BYTE_BUFFER_SIZE); in StreamEncoder() 216 this.bb = ByteBuffer.allocate(mbc < 0 in StreamEncoder() 222 bb.flip(); in writeBytes() 223 int lim = bb.limit(); in writeBytes() 224 int pos = bb.position(); in writeBytes() 230 if (ch.write(bb) != rem) in writeBytes() 233 out.write(bb.array(), bb.arrayOffset() + pos, rem); in writeBytes() 236 bb.clear(); in writeBytes() [all …]
|
D | StreamDecoder.java | 227 private ByteBuffer bb; field in StreamDecoder 249 bb = ByteBuffer.allocateDirect(DEFAULT_BYTE_BUFFER_SIZE); in StreamDecoder() 254 bb = ByteBuffer.allocate(DEFAULT_BYTE_BUFFER_SIZE); in StreamDecoder() 256 bb.flip(); // So that bb is initially empty in StreamDecoder() 264 this.bb = ByteBuffer.allocate(mbc < 0 in StreamDecoder() 269 bb.flip(); in StreamDecoder() 273 bb.compact(); in readBytes() 281 int n = sun.nio.ch.ChannelInputStream.read(ch, bb, true); in readBytes() 286 int lim = bb.limit(); in readBytes() 287 int pos = bb.position(); in readBytes() [all …]
|
/libcore/luni/src/test/java/libcore/java/nio/ |
D | OldAndroidNIOTest.java | 201 ByteBuffer bb = b.slice(); in byteBufferTest() local 202 checkBuffer(bb); in byteBufferTest() 204 assertEquals(0, bb.position()); in byteBufferTest() 205 assertEquals(4, bb.limit()); in byteBufferTest() 206 assertEquals(4, bb.capacity()); in byteBufferTest() 208 assertEquals((byte) 0xA6, bb.get()); in byteBufferTest() 209 assertEquals((byte) 0xA7, bb.get()); in byteBufferTest() 210 assertEquals((byte) 0xA8, bb.get()); in byteBufferTest() 211 assertEquals((byte) 0xA9, bb.get()); in byteBufferTest() 213 bb.get(); in byteBufferTest() [all …]
|
/libcore/ojluni/src/main/java/sun/misc/ |
D | CharacterEncoder.java | 210 private byte [] getBytes(ByteBuffer bb) { in getBytes() argument 221 if (bb.hasArray()) { in getBytes() 222 byte [] tmp = bb.array(); in getBytes() 223 if ((tmp.length == bb.capacity()) && in getBytes() 224 (tmp.length == bb.remaining())) { in getBytes() 226 bb.position(bb.limit()); in getBytes() 236 buf = new byte[bb.remaining()]; in getBytes() 241 bb.get(buf); in getBytes()
|
/libcore/ojluni/src/main/java/java/util/zip/ |
D | ZipCoder.java | 79 ByteBuffer bb = encoder().encode(CharBuffer.wrap(s)); in getBytes() local 80 int pos = bb.position(); in getBytes() 81 int limit = bb.limit(); in getBytes() 82 if (bb.hasArray() && pos == 0 && limit == bb.capacity()) { in getBytes() 83 return bb.array(); in getBytes() 85 byte[] bytes = new byte[bb.limit() - bb.position()]; in getBytes() 86 bb.get(bytes); in getBytes()
|
/libcore/ojluni/src/main/java/sun/security/util/ |
D | HexDumpEncoder.java | 208 private byte [] getBytes(ByteBuffer bb) { in getBytes() argument 219 if (bb.hasArray()) { in getBytes() 220 byte [] tmp = bb.array(); in getBytes() 221 if ((tmp.length == bb.capacity()) && in getBytes() 222 (tmp.length == bb.remaining())) { in getBytes() 224 bb.position(bb.limit()); in getBytes() 234 buf = new byte[bb.remaining()]; in getBytes() 239 bb.get(buf); in getBytes()
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/ |
D | SSLEngineTest.java | 344 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_02() local 349 sse.unwrap(bb, bbA, -1, 3); in test_unwrap_02() 354 sse.unwrap(bb, bbA, 0, -3); in test_unwrap_02() 359 sse.unwrap(bb, bbA, bbA.length + 1, bbA.length); in test_unwrap_02() 364 sse.unwrap(bb, bbA, 0, bbA.length + 1); in test_unwrap_02() 381 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_03() local 386 sse.unwrap(bb, bbA, 0, bbA.length); in test_unwrap_03() 403 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_04() local 414 sse.unwrap(bb, bbAN, 0, 3); in test_unwrap_04() 419 sse.unwrap(bb, bbN, 0, 0); in test_unwrap_04() [all …]
|