diff options
author | Dominik Stadler <centic@apache.org> | 2020-05-16 13:06:20 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2020-05-16 13:06:20 +0000 |
commit | c61cd6fa03f519eb706e1e3efa3cdf742c5aae29 (patch) | |
tree | 6547bf11e6fd6bda9a096e14971eb8a28e4b8581 /src/java/org/apache/poi/poifs | |
parent | eb497bac7901dff141f614b57ce7794a7fda44a5 (diff) | |
download | poi-c61cd6fa03f519eb706e1e3efa3cdf742c5aae29.tar.gz poi-c61cd6fa03f519eb706e1e3efa3cdf742c5aae29.zip |
Fix some IDE warnings, make lock-objects final, use generics, remove unused allocated fields to reduce memory overhead of DocumentInputStream
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1877818 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs')
-rw-r--r-- | src/java/org/apache/poi/poifs/common/POIFSConstants.java | 48 | ||||
-rw-r--r-- | src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java | 5 |
2 files changed, 24 insertions, 29 deletions
diff --git a/src/java/org/apache/poi/poifs/common/POIFSConstants.java b/src/java/org/apache/poi/poifs/common/POIFSConstants.java index 1cc5d038d6..7cacb68fe8 100644 --- a/src/java/org/apache/poi/poifs/common/POIFSConstants.java +++ b/src/java/org/apache/poi/poifs/common/POIFSConstants.java @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - + package org.apache.poi.poifs.common; @@ -25,43 +25,43 @@ package org.apache.poi.poifs.common; public interface POIFSConstants { /** Most files use 512 bytes as their big block size */ - public static final int SMALLER_BIG_BLOCK_SIZE = 0x0200; - public static final POIFSBigBlockSize SMALLER_BIG_BLOCK_SIZE_DETAILS = + int SMALLER_BIG_BLOCK_SIZE = 0x0200; + POIFSBigBlockSize SMALLER_BIG_BLOCK_SIZE_DETAILS = new POIFSBigBlockSize(SMALLER_BIG_BLOCK_SIZE, (short)9); /** Some use 4096 bytes */ - public static final int LARGER_BIG_BLOCK_SIZE = 0x1000; - public static final POIFSBigBlockSize LARGER_BIG_BLOCK_SIZE_DETAILS = + int LARGER_BIG_BLOCK_SIZE = 0x1000; + POIFSBigBlockSize LARGER_BIG_BLOCK_SIZE_DETAILS = new POIFSBigBlockSize(LARGER_BIG_BLOCK_SIZE, (short)12); - + /** How big a block in the small block stream is. Fixed size */ - public static final int SMALL_BLOCK_SIZE = 0x0040; - + int SMALL_BLOCK_SIZE = 0x0040; + /** How big a single property is */ - public static final int PROPERTY_SIZE = 0x0080; - - /** - * The minimum size of a document before it's stored using - * Big Blocks (normal streams). Smaller documents go in the + int PROPERTY_SIZE = 0x0080; + + /** + * The minimum size of a document before it's stored using + * Big Blocks (normal streams). Smaller documents go in the * Mini Stream (SBAT / Small Blocks) */ - public static final int BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000; - + int BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000; + /** The highest sector number you're allowed, 0xFFFFFFFA */ - public static final int LARGEST_REGULAR_SECTOR_NUMBER = -5; - + int LARGEST_REGULAR_SECTOR_NUMBER = -5; + /** Indicates the sector holds a DIFAT block (0xFFFFFFFC) */ - public static final int DIFAT_SECTOR_BLOCK = -4; + int DIFAT_SECTOR_BLOCK = -4; /** Indicates the sector holds a FAT block (0xFFFFFFFD) */ - public static final int FAT_SECTOR_BLOCK = -3; + int FAT_SECTOR_BLOCK = -3; /** Indicates the sector is the end of a chain (0xFFFFFFFE) */ - public static final int END_OF_CHAIN = -2; + int END_OF_CHAIN = -2; /** Indicates the sector is not used (0xFFFFFFFF) */ - public static final int UNUSED_BLOCK = -1; - + int UNUSED_BLOCK = -1; + /** The first 4 bytes of an OOXML file, used in detection */ - public static final byte[] OOXML_FILE_HEADER = + byte[] OOXML_FILE_HEADER = new byte[] { 0x50, 0x4b, 0x03, 0x04 }; /** The first 5 bytes of a raw XML file, used in detection */ - public static final byte[] RAW_XML_FILE_HEADER = + byte[] RAW_XML_FILE_HEADER = new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c }; } // end public interface POIFSConstants; diff --git a/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java b/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java index 26769a94ea..bf07261ef9 100644 --- a/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java +++ b/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java @@ -36,11 +36,6 @@ import org.apache.poi.util.LittleEndianInput; * {@link POIFSFileSystem} instance. */ public final class DocumentInputStream extends InputStream implements LittleEndianInput { - - private static int SKIP_BUFFER_SIZE = 2048; - - private static byte[] SKIP_BYTE_BUFFER = new byte[SKIP_BUFFER_SIZE]; - /** returned by read operations if we're at end of document */ private static final int EOF = -1; |