diff options
author | Jesse Wilson <jessewilson@google.com> | 2012-03-28 08:30:28 -0400 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2013-04-30 14:52:21 -0700 |
commit | 0436f436f122e7e74285faf32b8db2259f56ded7 (patch) | |
tree | c5ae75d83392b4d0b49f03d69ee37d6be360a665 /dex | |
parent | 04b2ff92ae27b3acd82148d9252253573638ccc6 (diff) | |
download | libcore-0436f436f122e7e74285faf32b8db2259f56ded7.zip libcore-0436f436f122e7e74285faf32b8db2259f56ded7.tar.gz libcore-0436f436f122e7e74285faf32b8db2259f56ded7.tar.bz2 |
Manually merge "Compact merged dexes on their byte aligned size"
The changed file was moved from dalvik/ to libcore/ in this branch.
See https://android-review.googlesource.com/34010
Change-Id: I9b2fae8767fb4e7461e9b762e70efb4171e7a9f5
(cherry picked from commit 20d13d20f6b8d4094d4d66bb692ac19c4b81348f)
Diffstat (limited to 'dex')
-rw-r--r-- | dex/src/main/java/com/android/dex/Dex.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dex/src/main/java/com/android/dex/Dex.java b/dex/src/main/java/com/android/dex/Dex.java index 8a3df96..b1ddc0a 100644 --- a/dex/src/main/java/com/android/dex/Dex.java +++ b/dex/src/main/java/com/android/dex/Dex.java @@ -412,10 +412,12 @@ public final class Dex { public final class Section implements ByteInput, ByteOutput { private final String name; private final ByteBuffer data; + private final int initialPosition; private Section(String name, ByteBuffer data) { this.name = name; this.data = data; + this.initialPosition = data.position(); } public int getPosition() { @@ -727,5 +729,12 @@ public final class Dex { public int remaining() { return data.remaining(); } + + /** + * Returns the number of bytes used by this section. + */ + public int used () { + return data.position() - initialPosition; + } } } |