Skip to content

Commit 01493a1

Browse files
author
Alexander Kozlov
committed
Add workaround to avoid ByteBufferRandomAccessSource usage by setting up default force read value
DEVSIX-6279
1 parent bd6b62c commit 01493a1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

io/src/main/java/com/itextpdf/io/source/RandomAccessSourceFactory.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ This file is part of the iText (R) project.
6060
*/
6161
public final class RandomAccessSourceFactory {
6262

63+
/**
64+
* The default value for the forceRead flag
65+
*/
66+
private static boolean forceReadDefaultValue = false;
6367

6468
/**
6569
* Whether the full content of the source should be read into memory at construction
6670
*/
67-
private boolean forceRead = false;
71+
private boolean forceRead = forceReadDefaultValue;
6872

6973
/**
7074
* Whether {@link java.io.RandomAccessFile} should be used instead of a {@link java.nio.channels.FileChannel}, where applicable
@@ -82,6 +86,14 @@ public final class RandomAccessSourceFactory {
8286
public RandomAccessSourceFactory() {
8387
}
8488

89+
/**
90+
* Determines the default value for the forceRead flag
91+
* @param forceRead true if by default the full content will be read, false otherwise
92+
*/
93+
public static void setForceReadDefaultValue(boolean forceRead) {
94+
forceReadDefaultValue = forceRead;
95+
}
96+
8597
/**
8698
* Determines whether the full content of the source will be read into memory
8799
* @param forceRead true if the full content will be read, false otherwise

0 commit comments

Comments
 (0)