//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for SoundData
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for SoundData
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* Record header.
public class HwmfText {
private static final Logger LOG = LogManager.getLogger(HwmfText.class);
- private static final int MAX_RECORD_LENGTH = 1_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 1_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HwmfText
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HwmfText
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* The META_SETTEXTCHAREXTRA record defines inter-character spacing for text justification in the
protected static final String STREAM_TABLE_1 = "1Table";
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 500_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 500_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HWPFDocumentCore
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HWPFDocumentCore
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
/**
* Size of the not encrypted part of the FIB
import org.apache.poi.util.StringUtil;
/**
- * Provides very simple support for old (Word 6 / Word 95)
- * files.
+ * Provides very simple support for old (Word 6 / Word 95) files.
*/
public class HWPFOldDocument extends HWPFDocumentCore {
private static final Logger LOG = LogManager.getLogger(HWPFOldDocument.class);
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 10_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 10_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for HWPFOldDocument
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for HWPFOldDocument
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
private static final Charset DEFAULT_CHARSET = StringUtil.WIN_1252;
@Internal
public class OldTextPieceTable extends TextPieceTable {
- //arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
public OldTextPieceTable() {
super();
int textSizeBytes = textSizeChars * multiple;
// Grab the data that makes up the piece
- byte[] buf = IOUtils.safelyClone(documentStream, start, textSizeBytes, MAX_RECORD_LENGTH);
+ byte[] buf = IOUtils.safelyClone(documentStream, start, textSizeBytes, getMaxRecordLength());
// And now build the piece
final TextPiece newTextPiece = newTextPiece(nodeStartChars, nodeEndChars, buf, pieces[x]);
/**
* The piece table for matching up character positions to bits of text. This
* mostly works in bytes, but the TextPieces themselves work in characters. This
- * does the icky convertion.
+ * does the icky conversion.
*/
@Internal
public class TextPieceTable implements CharIndexTranslator {
private static final Logger LOG = LogManager.getLogger(TextPieceTable.class);
//arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 100_000_000;
+ private static final int DEFAULT_MAX_RECORD_LENGTH = 100_000_000;
+ private static int MAX_RECORD_LENGTH = DEFAULT_MAX_RECORD_LENGTH;
+
+ /**
+ * @param length the max record length allowed for TextPieceTable
+ */
+ public static void setMaxRecordLength(int length) {
+ MAX_RECORD_LENGTH = length;
+ }
+
+ /**
+ * @return the max record length allowed for TextPieceTable
+ */
+ public static int getMaxRecordLength() {
+ return MAX_RECORD_LENGTH;
+ }
// int _multiple;