From: Nick Burch Date: Mon, 27 Dec 2010 04:04:47 +0000 (+0000) Subject: Move the SBAT/BAT cutoff constant to POIFSConstants X-Git-Tag: REL_3_8_BETA1~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=42e0f7b74578f21942bd767df242381f885c4f00;p=poi.git Move the SBAT/BAT cutoff constant to POIFSConstants git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1052995 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/poifs/common/POIFSConstants.java b/src/java/org/apache/poi/poifs/common/POIFSConstants.java index 5a260f4210..74bc037d13 100644 --- a/src/java/org/apache/poi/poifs/common/POIFSConstants.java +++ b/src/java/org/apache/poi/poifs/common/POIFSConstants.java @@ -35,6 +35,13 @@ public interface POIFSConstants 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 + * Mini Stream (SBAT / Small Blocks) + */ + public static final int BIG_BLOCK_MINIMUM_DOCUMENT_SIZE = 0x1000; + /** The highest sector number you're allowed, 0xFFFFFFFA */ public static final int LARGEST_REGULAR_SECTOR_NUMBER = -5; diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java index edffb6b45a..947729f060 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java +++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSStream.java @@ -97,7 +97,7 @@ public class NPOIFSStream implements Iterable * Updates the contents of the stream to the new * set of bytes. * Note - if this is property based, you'll still - * need to + * need to update the size in the property yourself */ public void updateContents(byte[] contents) throws IOException { // How many blocks are we going to need? diff --git a/src/java/org/apache/poi/poifs/property/Property.java b/src/java/org/apache/poi/poifs/property/Property.java index c1e8c0e1c1..127dab1e39 100644 --- a/src/java/org/apache/poi/poifs/property/Property.java +++ b/src/java/org/apache/poi/poifs/property/Property.java @@ -65,7 +65,7 @@ public abstract class Property implements Child, POIFSViewable { static final protected byte _NODE_RED = 0; // documents must be at least this size to be stored in big blocks - static final private int _big_block_minimum_bytes = 4096; + static final private int _big_block_minimum_bytes = POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE; private String _name; private ShortField _name_size; private ByteField _property_type;