aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs/storage/BigBlock.java
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2010-04-25 17:35:56 +0000
committerNick Burch <nick@apache.org>2010-04-25 17:35:56 +0000
commit7f12b6ff534f0c9f8650ab199ed0b9d7191fc87a (patch)
tree479157ab3724eb1db6f4890bd38fd853d752a3d6 /src/java/org/apache/poi/poifs/storage/BigBlock.java
parente38be4e0a7c56df7ae7ccddb0586e3e92d9ccd1d (diff)
downloadpoi-7f12b6ff534f0c9f8650ab199ed0b9d7191fc87a.tar.gz
poi-7f12b6ff534f0c9f8650ab199ed0b9d7191fc87a.zip
Resolve bug #49139 - don't assume that the block size is always 512 bytes. Instead of hard coding this value in, pass around the new POIFSBigBlockSize object that holds the size and various helper subsizes. Should now be possible to open 4k block files without error.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@937834 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs/storage/BigBlock.java')
-rw-r--r--src/java/org/apache/poi/poifs/storage/BigBlock.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/poifs/storage/BigBlock.java b/src/java/org/apache/poi/poifs/storage/BigBlock.java
index 2ca0d307d9..e9b41928b3 100644
--- a/src/java/org/apache/poi/poifs/storage/BigBlock.java
+++ b/src/java/org/apache/poi/poifs/storage/BigBlock.java
@@ -33,9 +33,21 @@ package org.apache.poi.poifs.storage;
import java.io.IOException;
import java.io.OutputStream;
+import org.apache.poi.poifs.common.POIFSBigBlockSize;
+import org.apache.poi.poifs.common.POIFSConstants;
+
abstract class BigBlock
implements BlockWritable
{
+ /**
+ * Either 512 bytes ({@link POIFSConstants#SMALLER_BIG_BLOCK_SIZE})
+ * or 4096 bytes ({@link POIFSConstants#LARGER_BIG_BLOCK_SIZE})
+ */
+ protected POIFSBigBlockSize bigBlockSize;
+
+ protected BigBlock(POIFSBigBlockSize bigBlockSize) {
+ this.bigBlockSize = bigBlockSize;
+ }
/**
* Default implementation of write for extending classes that