Home
last modified time | relevance | path

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

123

/libcore/ojluni/src/main/java/java/nio/
DBits.java69 static char getCharL(ByteBuffer bb, int bi) { in getCharL() argument
70 return makeChar(bb._get(bi + 1), in getCharL()
71 bb._get(bi)); in getCharL()
79 static char getCharB(ByteBuffer bb, int bi) { in getCharB() argument
80 return makeChar(bb._get(bi), in getCharB()
81 bb._get(bi + 1)); in getCharB()
89 static char getChar(ByteBuffer bb, int bi, boolean bigEndian) { in getChar() argument
90 return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi); in getChar()
105 static void putCharL(ByteBuffer bb, int bi, char x) { in putCharL() argument
106 bb._put(bi, char0(x)); in putCharL()
[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 …]
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 …]
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 …]
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 …]
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/sun/nio/ch/
DChannelInputStream.java53 public static int read(ReadableByteChannel ch, ByteBuffer bb) in read() argument
65 int n = ch.read(bb); in read()
72 return ch.read(bb); in read()
77 private ByteBuffer bb = null; field in ChannelInputStream
103 ByteBuffer bb = ((this.bs == bs) in read()
104 ? this.bb in read()
106 bb.limit(Math.min(off + len, bb.capacity())); in read()
107 bb.position(off); in read()
108 this.bb = bb; in read()
110 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 …]
DUtil.java91 ByteBuffer bb = buffers[i]; in get() local
92 if (bb == null) in get()
94 if (bb.capacity() >= size) { in get()
95 buf = bb; in get()
279 static void erase(ByteBuffer bb) {
280 unsafe.setMemory(((DirectBuffer)bb).address(), bb.capacity(), (byte)0);
DDatagramChannelImpl.java380 ByteBuffer bb = null; in receive() local
394 bb = Util.getTemporaryDirectBuffer(dst.remaining()); in receive()
397 n = receive(fd, bb); in receive()
408 bb.clear(); in receive()
412 bb.flip(); in receive()
413 dst.put(bb); in receive()
419 if (bb != null) in receive()
420 Util.releaseTemporaryDirectBuffer(bb); in receive()
442 ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize); in receive() local
446 int n = receiveIntoNativeBuffer(fd, bb, newSize, 0); in receive()
[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/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.java226 private ByteBuffer bb; field in StreamDecoder
248 bb = ByteBuffer.allocateDirect(DEFAULT_BYTE_BUFFER_SIZE); in StreamDecoder()
253 bb = ByteBuffer.allocate(DEFAULT_BYTE_BUFFER_SIZE); in StreamDecoder()
255 bb.flip(); // So that bb is initially empty in StreamDecoder()
263 this.bb = ByteBuffer.allocate(mbc < 0 in StreamDecoder()
268 bb.flip(); in StreamDecoder()
272 bb.compact(); in readBytes()
278 int n = sun.nio.ch.ChannelInputStream.read(ch, bb); in readBytes()
283 int lim = bb.limit(); in readBytes()
284 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.java331 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_02() local
336 sse.unwrap(bb, bbA, -1, 3); in test_unwrap_02()
341 sse.unwrap(bb, bbA, 0, -3); in test_unwrap_02()
346 sse.unwrap(bb, bbA, bbA.length + 1, bbA.length); in test_unwrap_02()
351 sse.unwrap(bb, bbA, 0, bbA.length + 1); in test_unwrap_02()
368 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_03() local
373 sse.unwrap(bb, bbA, 0, bbA.length); in test_unwrap_03()
390 ByteBuffer bb = ByteBuffer.allocate(10); in test_unwrap_04() local
401 sse.unwrap(bb, bbAN, 0, 3); in test_unwrap_04()
406 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.java150 byte[] bb = cSpi.engineGetIV(); in testCipherSpiTests01()
151 assertEquals("Length of result byte array is not 0", bb.length, 0); in testCipherSpiTests01()
155 bb = cSpi.engineUpdate(bb1, 1, 2); in testCipherSpiTests01()
157 bb.length, 2); in testCipherSpiTests01()
158 bb = cSpi.engineDoFinal(bb1, 1, 2); in testCipherSpiTests01()
160 bb.length); in testCipherSpiTests01()
216 byte[] bb = { (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4, in testCipherSpi05()
219 int len = bb.length; in testCipherSpi05()
222 bb1.put(bb); in testCipherSpi05()
234 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/lang/
DStringCoding.java165 ByteBuffer bb = ByteBuffer.wrap(ba, off, len); in decode() local
168 CoderResult cr = cd.decode(bb, cb, true); in decode()
240 ByteBuffer bb = ByteBuffer.wrap(ba, off, len); in decode() local
243 CoderResult cr = cd.decode(bb, cb, true); in decode()
316 ByteBuffer bb = ByteBuffer.wrap(ba); in encode() local
320 CoderResult cr = ce.encode(cb.asReadOnlyBuffer(), bb, true); in encode()
323 cr = ce.flush(bb); in encode()
331 return safeTrim(ba, bb.position(), cs, isTrusted); in encode()
376 ByteBuffer bb = ByteBuffer.wrap(ba); in encode() local
380 CoderResult cr = ce.encode(cb.asReadOnlyBuffer(), bb, true); in encode()
[all …]

123