Home
last modified time | relevance | path

Searched refs:bb (Results 1 – 25 of 52) sorted by relevance

123

/libcore/ojluni/src/main/java/java/nio/
DBits.java68 static char getCharL(ByteBuffer bb, int bi) { in getCharL() argument
69 return makeChar(bb._get(bi + 1), in getCharL()
70 bb._get(bi )); in getCharL()
78 static char getCharB(ByteBuffer bb, int bi) { in getCharB() argument
79 return makeChar(bb._get(bi ), in getCharB()
80 bb._get(bi + 1)); in getCharB()
88 static char getChar(ByteBuffer bb, int bi, boolean bigEndian) { in getChar() argument
89 return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi); in getChar()
99 static void putCharL(ByteBuffer bb, int bi, char x) { in putCharL() argument
100 bb._put(bi , char0(x)); in putCharL()
[all …]
DByteBufferAsFloatBuffer.java32 protected final ByteBuffer bb; field in ByteBufferAsFloatBuffer
36 ByteBufferAsFloatBuffer(ByteBuffer bb, in ByteBufferAsFloatBuffer() argument
40 this.bb = bb.duplicate(); in ByteBufferAsFloatBuffer()
41 this.isReadOnly = bb.isReadOnly; in ByteBufferAsFloatBuffer()
49 if (bb instanceof DirectByteBuffer) { in ByteBufferAsFloatBuffer()
50 this.address = bb.address + off; in ByteBufferAsFloatBuffer()
52 this.bb.order(order); in ByteBufferAsFloatBuffer()
64 return new ByteBufferAsFloatBuffer(bb, -1, 0, rem, rem, off, order); in slice()
68 return new ByteBufferAsFloatBuffer(bb, in duplicate()
78 return new ByteBufferAsFloatBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
DByteBufferAsLongBuffer.java32 protected final ByteBuffer bb; field in ByteBufferAsLongBuffer
36 ByteBufferAsLongBuffer(ByteBuffer bb, in ByteBufferAsLongBuffer() argument
40 this.bb = bb.duplicate(); in ByteBufferAsLongBuffer()
41 this.isReadOnly = bb.isReadOnly; in ByteBufferAsLongBuffer()
49 if (bb instanceof DirectByteBuffer) { in ByteBufferAsLongBuffer()
50 this.address = bb.address + off; in ByteBufferAsLongBuffer()
52 this.bb.order(order); in ByteBufferAsLongBuffer()
64 return new ByteBufferAsLongBuffer(bb, -1, 0, rem, rem, off, order); in slice()
68 return new ByteBufferAsLongBuffer(bb, in duplicate()
78 return new ByteBufferAsLongBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
DByteBufferAsIntBuffer.java32 protected final ByteBuffer bb; field in ByteBufferAsIntBuffer
36 ByteBufferAsIntBuffer(ByteBuffer bb, in ByteBufferAsIntBuffer() argument
40 this.bb = bb.duplicate(); in ByteBufferAsIntBuffer()
41 this.isReadOnly = bb.isReadOnly; in ByteBufferAsIntBuffer()
49 if (bb instanceof DirectByteBuffer) { in ByteBufferAsIntBuffer()
50 this.address = bb.address + off; in ByteBufferAsIntBuffer()
52 this.bb.order(order); in ByteBufferAsIntBuffer()
64 return new ByteBufferAsIntBuffer(bb, -1, 0, rem, rem, off, order); in slice()
68 return new ByteBufferAsIntBuffer(bb, in duplicate()
78 return new ByteBufferAsIntBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
DByteBufferAsShortBuffer.java32 protected final ByteBuffer bb; field in ByteBufferAsShortBuffer
36 ByteBufferAsShortBuffer(ByteBuffer bb, in ByteBufferAsShortBuffer() argument
40 this.bb = bb.duplicate(); in ByteBufferAsShortBuffer()
41 this.isReadOnly = bb.isReadOnly; in ByteBufferAsShortBuffer()
49 if (bb instanceof DirectByteBuffer) { in ByteBufferAsShortBuffer()
50 this.address = bb.address + off; in ByteBufferAsShortBuffer()
52 this.bb.order(order); in ByteBufferAsShortBuffer()
64 return new ByteBufferAsShortBuffer(bb, -1, 0, rem, rem, off, order); in slice()
68 return new ByteBufferAsShortBuffer(bb, in duplicate()
77 return new ByteBufferAsShortBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
DByteBufferAsDoubleBuffer.java33 protected final ByteBuffer bb; field in ByteBufferAsDoubleBuffer
37 ByteBufferAsDoubleBuffer(ByteBuffer bb, in ByteBufferAsDoubleBuffer() argument
41 this.bb = bb.duplicate(); in ByteBufferAsDoubleBuffer()
42 this.isReadOnly = bb.isReadOnly; in ByteBufferAsDoubleBuffer()
50 if (bb instanceof DirectByteBuffer) { in ByteBufferAsDoubleBuffer()
51 this.address = bb.address + off; in ByteBufferAsDoubleBuffer()
53 this.bb.order(order); in ByteBufferAsDoubleBuffer()
65 return new ByteBufferAsDoubleBuffer(bb, -1, 0, rem, rem, off, order); in slice()
69 return new ByteBufferAsDoubleBuffer(bb, in duplicate()
79 return new ByteBufferAsDoubleBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
DByteBufferAsCharBuffer.java32 protected final ByteBuffer bb; field in ByteBufferAsCharBuffer
36 ByteBufferAsCharBuffer(ByteBuffer bb, in ByteBufferAsCharBuffer() argument
40 this.bb = bb.duplicate(); in ByteBufferAsCharBuffer()
41 this.isReadOnly = bb.isReadOnly; in ByteBufferAsCharBuffer()
49 if (bb instanceof DirectByteBuffer) { in ByteBufferAsCharBuffer()
50 this.address = bb.address + off; in ByteBufferAsCharBuffer()
52 this.bb.order(order); in ByteBufferAsCharBuffer()
64 return new ByteBufferAsCharBuffer(bb, -1, 0, rem, rem, off, order); in slice()
68 return new ByteBufferAsCharBuffer(bb, in duplicate()
78 return new ByteBufferAsCharBuffer(bb.asReadOnlyBuffer(), in asReadOnlyBuffer()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/charset/
DCharsetEncoderTest.java71 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/main/java/java/nio/channels/
DChannels.java75 private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb) in writeFullyImpl() argument
78 while (bb.remaining() > 0) { in writeFullyImpl()
79 int n = ch.write(bb); in writeFullyImpl()
91 private static void writeFully(WritableByteChannel ch, ByteBuffer bb) in writeFully() argument
99 writeFullyImpl(ch, bb); in writeFully()
102 writeFullyImpl(ch, bb); in writeFully()
148 private ByteBuffer bb = null; in newOutputStream()
168 ByteBuffer bb = ((this.bs == bs) in newOutputStream() local
169 ? this.bb in newOutputStream()
171 bb.limit(Math.min(off + len, bb.capacity())); in newOutputStream()
[all …]
/libcore/ojluni/src/main/java/sun/nio/ch/
DChannelInputStream.java48 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
97 ByteBuffer bb = ((this.bs == bs) in read()
98 ? this.bb in read()
100 bb.limit(Math.min(off + len, bb.capacity())); in read()
101 bb.position(off); in read()
102 this.bb = bb; in read()
104 return read(bb); in read()
[all …]
DIOUtil.java58 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 …]
DDatagramSocketAdaptor.java145 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 …]
DDatagramChannelImpl.java374 ByteBuffer bb = null; in receive() local
388 bb = Util.getTemporaryDirectBuffer(dst.remaining()); in receive()
391 n = receive(fd, bb); in receive()
402 bb.clear(); in receive()
406 bb.flip(); in receive()
407 dst.put(bb); in receive()
413 if (bb != null) in receive()
414 Util.releaseTemporaryDirectBuffer(bb); in receive()
436 ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize); in receive() local
441 int n = receiveIntoNativeBuffer(fd, bb, newSize, 0); in receive()
[all …]
DUtil.java144 ByteBuffer bb = buffers[i]; in get() local
145 if (bb == null) in get()
147 if (bb.capacity() >= size) { in get()
148 buf = bb; in get()
363 static void erase(ByteBuffer bb) {
364 unsafe.setMemory(((DirectBuffer)bb).address(), bb.capacity(), (byte)0);
/libcore/ojluni/src/main/java/sun/nio/cs/
DStreamEncoder.java163 private ByteBuffer bb; field in StreamEncoder
192 bb = ByteBuffer.allocateDirect(DEFAULT_BYTE_BUFFER_SIZE); in StreamEncoder()
195 bb = ByteBuffer.allocate(DEFAULT_BYTE_BUFFER_SIZE); in StreamEncoder()
204 this.bb = ByteBuffer.allocate(mbc < 0 in StreamEncoder()
210 bb.flip(); in writeBytes()
211 int lim = bb.limit(); in writeBytes()
212 int pos = bb.position(); in writeBytes()
218 if (ch.write(bb) != rem) in writeBytes()
221 out.write(bb.array(), bb.arrayOffset() + pos, rem); in writeBytes()
224 bb.clear(); in writeBytes()
[all …]
DStreamDecoder.java227 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/
DOldAndroidNIOTest.java201 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/
DCharacterEncoder.java210 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/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/
DSSLEngineTest.java344 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 …]
/libcore/ojluni/src/main/java/java/util/zip/
DZipCoder.java61 ByteBuffer bb = ByteBuffer.wrap(ba, 0, length); in toString() local
63 CoderResult cr = cd.decode(bb, cb, true); in toString()
91 ByteBuffer bb = ByteBuffer.wrap(ba); in getBytes() local
93 CoderResult cr = ce.encode(cb, bb, true); in getBytes()
96 cr = ce.flush(bb); in getBytes()
99 if (bb.position() == ba.length) // defensive copy? in getBytes()
102 return Arrays.copyOf(ba, bb.position()); in getBytes()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/
DAbstractCharsetTestCase.java140 ByteBuffer bb = this.testingCharset.encode(input); in internalTestEncode() local
142 bb.rewind(); in internalTestEncode()
143 while (bb.hasRemaining() && i < output.length) { in internalTestEncode()
144 assertEquals(output[i], bb.get()); in internalTestEncode()
147 assertFalse(bb.hasRemaining()); in internalTestEncode()
/libcore/ojluni/src/main/java/sun/nio/fs/
DAbstractUserDefinedFileAttributeView.java66 ByteBuffer bb; in setAttribute() local
68 bb = ByteBuffer.wrap((byte[])value); in setAttribute()
70 bb = (ByteBuffer)value; in setAttribute()
72 write(attribute, bb); in setAttribute()
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/
DCipherSpiTest.java160 byte[] bb = cSpi.engineGetIV(); in testCipherSpiTests01()
161 assertEquals("Length of result byte array is not 0", bb.length, 0); in testCipherSpiTests01()
165 bb = cSpi.engineUpdate(bb1, 1, 2); in testCipherSpiTests01()
167 bb.length, 2); in testCipherSpiTests01()
168 bb = cSpi.engineDoFinal(bb1, 1, 2); in testCipherSpiTests01()
170 bb.length); in testCipherSpiTests01()
226 byte[] bb = { (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, in testCipherSpi05()
229 int len = bb.length; in testCipherSpi05()
232 bb1.put(bb); in testCipherSpi05()
244 ByteBuffer bb2 = ByteBuffer.allocate(bb.length); in testCipherSpi05()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/channels/
DChannelsTest.java84 ByteBuffer bb = bbCaptor.getValue(); in testInputStreamAsynchronousByteChannel()
85 assertEquals(bytesRead.length, bb.remaining()); in testInputStreamAsynchronousByteChannel()
87 bb.put(new byte[] {0, 1, 2, 3, 4, 5, 6}); in testInputStreamAsynchronousByteChannel()
112 ByteBuffer bb = bbCaptor.getValue(); in testOutputStreamAsynchronousByteChannel()
113 assertEquals(data.length, bb.remaining()); in testOutputStreamAsynchronousByteChannel()
116 bb.get(readData); in testOutputStreamAsynchronousByteChannel()
/libcore/ojluni/src/main/java/java/util/
DBitSet.java268 public static BitSet valueOf(ByteBuffer bb) { in valueOf() argument
269 bb = bb.slice().order(ByteOrder.LITTLE_ENDIAN); in valueOf()
271 for (n = bb.remaining(); n > 0 && bb.get(n - 1) == 0; n--) in valueOf()
274 bb.limit(n); in valueOf()
276 while (bb.remaining() >= 8) in valueOf()
277 words[i++] = bb.getLong(); in valueOf()
278 for (int remaining = bb.remaining(), j = 0; j < remaining; j++) in valueOf()
279 words[i] |= (bb.get() & 0xffL) << (8 * j); in valueOf()
304 ByteBuffer bb = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); in toByteArray() local
306 bb.putLong(words[i]); in toByteArray()
[all …]

123