diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-06-11 00:43:45 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-06-11 00:43:45 +0000 |
commit | d559feb7deff492fd196bfbaf05888db1305cc45 (patch) | |
tree | 87aa211c95598a860ece3fc500d4197593361be8 /src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java | |
parent | 0181d2abd90142edc4572ca3acdc88cefeb6a3a4 (diff) | |
download | poi-d559feb7deff492fd196bfbaf05888db1305cc45.tar.gz poi-d559feb7deff492fd196bfbaf05888db1305cc45.zip |
64512 - Ole10Native aka embedded / object packager - handle UTF16 variants
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1878730 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java')
-rw-r--r-- | src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java b/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java index 0a28333e25..c1bbaabb73 100644 --- a/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java +++ b/src/java/org/apache/poi/util/LittleEndianByteArrayInputStream.java @@ -91,8 +91,8 @@ public class LittleEndianByteArrayInputStream extends ByteArrayInputStream imple } this.pos = pos; } - - + + @Override public byte readByte() { checkPosition(1); @@ -140,14 +140,14 @@ public class LittleEndianByteArrayInputStream extends ByteArrayInputStream imple } public long readUInt() { - return readInt() & 0x00FFFFFFFFL; + return readInt() & 0x00FFFFFFFFL; } @Override public double readDouble() { return Double.longBitsToDouble(readLong()); } - + @Override public void readFully(byte[] buffer, int off, int len) { checkPosition(len); @@ -164,4 +164,12 @@ public class LittleEndianByteArrayInputStream extends ByteArrayInputStream imple public void readPlain(byte[] buf, int off, int len) { readFully(buf, off, len); } + + /** + * Change the limit of the ByteArrayInputStream + * @param size the new limit - is truncated to length of internal buffer + */ + public void limit(int size) { + count = Math.min(size, buf.length); + } } |