Author: axh
Date: Thu Feb 22 15:44:31 2024
New Revision: 1915953
URL: http://svn.apache.org/viewvc?rev=1915953&view=rev
Log:
do not write single bytes
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/Zip64Impl.java
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/Zip64Impl.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/Zip64Impl.java?rev=1915953&r1=1915952&r2=1915953&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/Zip64Impl.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/Zip64Impl.java
Thu Feb 22 15:44:31 2024
@@ -145,9 +145,10 @@ class Zip64Impl {
* Writes a 16-bit short to the output stream in little-endian byte order.
*/
private void writeShort(int v) throws IOException {
- OutputStream out = this.out;
- out.write((v >>> 0) & 0xff);
- out.write((v >>> 8) & 0xff);
+ out.write(new byte[]{
+ (byte) ((v >>> 0) & 0xff),
+ (byte) ((v >>> 8) & 0xff)
+ });
written += 2;
}
@@ -155,11 +156,12 @@ class Zip64Impl {
* Writes a 32-bit int to the output stream in little-endian byte order.
*/
private void writeInt(long v) throws IOException {
- OutputStream out = this.out;
- out.write((int) ((v >>> 0) & 0xff));
- out.write((int) ((v >>> 8) & 0xff));
- out.write((int) ((v >>> 16) & 0xff));
- out.write((int) ((v >>> 24) & 0xff));
+ out.write(new byte[]{
+ (byte) ((v >>> 0) & 0xff),
+ (byte) ((v >>> 8) & 0xff),
+ (byte) ((v >>> 16) & 0xff),
+ (byte) ((v >>> 24) & 0xff)
+ });
written += 4;
}
@@ -167,17 +169,17 @@ class Zip64Impl {
* Writes a 64-bit int to the output stream in little-endian byte order.
*/
private void writeLong(long v) throws IOException {
- OutputStream out = this.out;
- out.write((int) ((v >>> 0) & 0xff));
- out.write((int) ((v >>> 8) & 0xff));
- out.write((int) ((v >>> 16) & 0xff));
- out.write((int) ((v >>> 24) & 0xff));
- out.write((int) ((v >>> 32) & 0xff));
- out.write((int) ((v >>> 40) & 0xff));
- out.write((int) ((v >>> 48) & 0xff));
- out.write((int) ((v >>> 56) & 0xff));
+ out.write(new byte[]{
+ (byte) ((v >>> 0) & 0xff),
+ (byte) ((v >>> 8) & 0xff),
+ (byte) ((v >>> 16) & 0xff),
+ (byte) ((v >>> 24) & 0xff),
+ (byte) ((v >>> 32) & 0xff),
+ (byte) ((v >>> 40) & 0xff),
+ (byte) ((v >>> 48) & 0xff),
+ (byte) ((v >>> 56) & 0xff)
+ });
written += 8;
}
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]