History log of /libcore/ojluni/src/main/java/java/nio/ByteBuffer.java
Revision Date Author Comments
7d2549c690bab5d4ccd8db0e501d61c2a4fc302c 16-Feb-2016 Narayan Kamath <narayan@google.com> ByteBuffer: Use |offset| directly.

Calling arrayOffset will throw for buffers that are read only.

This fixes FileChannelTest#testReadOnlyByteArrays and
BufferTest#testPutByteBuffer.

Also contains some pedantic trailing whitespace removal.

Change-Id: Ib6335a1a542d78702721e16ff4b39dc353564301
9a4a5c7df68495cce39ed2cbfe27615714c72535 12-Feb-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fix ByteBuffer performance regression.

Use libcore.io.Memory.memmove for mmaped ByteBuffer and
non-bytearray-backed direct ByteBuffer#put(ByteBuffer)
operations.

Bug: 26989924
Change-Id: I660a7431061efbeeb6880c85f524c6fdffc760a0
(cherry picked from commit 27c702be4464b10bc99900769bc037fe4b0cfb7f)
27c702be4464b10bc99900769bc037fe4b0cfb7f 12-Feb-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fix ByteBuffer performance regression.

Use libcore.io.Memory.memmove for mmaped ByteBuffer and
non-bytearray-backed direct ByteBuffer#put(ByteBuffer)
operations.

Bug: 26989924
Change-Id: I660a7431061efbeeb6880c85f524c6fdffc760a0
2c87ad3a45cecf9e344487cad1abfdebe79f2c7c 21-Dec-2015 Narayan Kamath <narayan@google.com> Update file headers.

Change-Id: I8149f41585768a1a4b72ab7bb4a1452376c05cc2
190a49036750b8bb6c979d958ed56aa3fb4f408a 15-Dec-2015 Shubham Ajmera <shubhamajmera@google.com> Formatted java.nio.* classes

according to Android style guidelines and removed extra white spaces.

Also, removed the templates from the package.

Change-Id: Ibc96d75c48201987087c87f8ea0c66a495eeb94c
fe0e5d3e460de87d24e0224ef10b089289355c47 12-Dec-2015 Narayan Kamath <narayan@google.com> Fix BufferTest#testFreed.

Each DirectByteBuffer now has a MemoryRef object associated with it.
This MemoryRef is shared across its duplicates and slices.

Also contains a few other surrounding cleanups :
- FileChannelImpl now allocates the DirectByteBuffer directly.
- Removed a pointless constructor from DirectByteBuffer.
- Removed unnecessary (pos << 0) shifts.

bug: 26020981
Change-Id: I573b48e621667c3cc2d78287678fba240783603d
f28b09a791e4e5635e4fcdfd1adde27aec0a1ed6 11-Dec-2015 Shubham Ajmera <shubhamajmera@google.com> Modify get|putArray methods in ByteBufferAs*Buffers

This will improve the performance of ByteBufferAs*Buffers. The past
implemention was making independent get and set calls for each element
of the array which resulted in the poor performance. The new
implementation uses Memory methods to handle the requests.

Change-Id: I6ee75a168946634164f85017d5fec25c47577dc6
e20e1b55eab0f2163e812a28cf3b3a682df38a1d 09-Dec-2015 Shubham Ajmera <shubhamajmera@google.com> Modify getters/setters of ByteBufferAs*Buffers

Added a different set of methods in DirectByteBuffer and HeapByteBuffer
to handle request from the ByteBufferAs*Buffers. The getters and setters
in ByteBufferAs*Buffer check limits instead of getters and setters of
Heap/DirectByteBuffer, therefore it becomes easier to maintain
local properties.

The change avoids making an extra copy of Heap/DirectByteBuffer at
the time of initialization.

Bug: 26020981
Bug: 6085292
Change-Id: I8af6ab60ec00b3eb9564d2fafad14bef6e61c15f
1817e4d9ef742ceebb2d6a04d624c086686b42ba 09-Dec-2015 Shubham Ajmera <shubhamajmera@google.com> Fix DirectByteBufferAlignment

and also an issue which was causing problems while accessing
ByteBufferArray when the buffer was created as duplicate/slice of a
duplicate/slice. A unit test was added for the same.

Bug: 26020981
Change-Id: Ice6c1d484b6fd68221f079949faed7d982230c1d
d80eadc041c833c2808beb823f4edb90ff7410f7 18-Nov-2015 Shubham Ajmera <shubhamajmera@google.com> FollowUp fixes for ByteBuffer

There were some issues caused after changes #815174, #815055,
#815164. Fixes include - using the correct constructor for deprecated
classes, issues with readonly flag, offset for sliced bytebuffer,
introducing isAccessible flag in place of isFreed flag, provided a
method to set accessible flag.

Change-Id: Ic6c7ae4e4f9a364b7dee4ed5ced382844f907ef5
fde0200e844b5c508b628da74a15eff193f31745 13-Nov-2015 Shubham Ajmera <shubhamajmera@google.com> Replace unSafe methods from DirectByteBuffer

Replaced unsafe memory allocation with Memory Class. Also, changed
getter and setter methods to use memory insead of unsafe methods. The
change has provided backing array for the direct byte buffers and memory
accesses using memory methods would improve performance.

Change-Id: If6ce26e501ab82fcfd4bcdb1e2db36d3a6913b07
66102fec246eb9e68e4e2d5c009f69902259823b 17-Nov-2015 Narayan Kamath <narayan@google.com> Revert "Replace unSafe methods from DirectByteBuffer"

This reverts commit eb638671b477b765d763ed737d5dcbe6e5e3102e.

Causes segmentation faults in dex2oat while compiling for arm64.

Change-Id: I5bcbb14740deaee7573c58010147259c02c4d332
eb638671b477b765d763ed737d5dcbe6e5e3102e 13-Nov-2015 Shubham Ajmera <shubhamajmera@google.com> Replace unSafe methods from DirectByteBuffer

Replaced unsafe memory allocation with Memory Class. Also, changed
getter and setter methods to use memory insead of unsafe methods. The
change has provided backing array for the direct byte buffers and memory
accesses using memory methods would improve performance.

Change-Id: Iebb7865d18360edb41a42d38daa7fc6b7e71ef28
0f7f0c999e751ab883a247e1409dcc8730c87b9f 23-Jul-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fixes for libcore.java.nio.BufferTest

- Added missing MappedByteBuffer native methods
- Fixed RandomAccessFile#getChannel permissions
- Disabled ByteBuffer#set/isAccessible parts of
BufferTest
- Marked set/isAccessible for removal (it will
be reimplemented in the framework).

Change-Id: I7d1999b35600ff45dd448a8b3671d9373559c1aa
648446e24ad82c2c660e158be8f32faabf082420 05-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.nio.*

- Unsafe: add more supporting methods.
- NIOAccess / NIOUtils : Track OpenJdk implementation.
- Bits : Initialize byte-order inline.
- Buffer : Add elementSizeShift.
- ByteBuffer : Add stub implementations of setAccessible and
isAccessible for use by the frameworks.

Change-Id: I07da77a7b8b9a2edd0410118fb697e5d3aa46fde
813d256b35a07885762b4726c08fd46fb91727e5 05-May-2015 Piotr Jastrzebski <haaawk@google.com> Add OpenJdk's ByteBuffer implementation.

Change-Id: I119214dfa2e968e269946270252e425090c5a5f5