java.lang.Object
org.sejda.io.util.IOUtils
Utility class with I/O related static methods
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final Optional<Consumer<ByteBuffer>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Consumer<ByteBuffer>newBufferCleaner(Class<?> unmappableBufferClass, MethodHandle unmapper) static voidunmap(ByteBuffer buf) Unmap memory mapped byte buffers.private static Consumer<ByteBuffer>unmapper()This is adapted from org.apache.lucene.store.MMapDirectory
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
UNMAPPER
-
-
Constructor Details
-
IOUtils
private IOUtils()
-
-
Method Details
-
unmap
Unmap memory mapped byte buffers. This is a hack waiting for a proper JVM provided solution expected in java 10 https://bugs.openjdk.java.net/browse/JDK-4724038 The issue here is that even when closed, memory mapped byte buffers hold a lock on the underlying file until GC is executed and this in turns result in an error if the user tries to move or delete the file.- Parameters:
buf-
-
unmapper
This is adapted from org.apache.lucene.store.MMapDirectory- Returns:
-
newBufferCleaner
private static Consumer<ByteBuffer> newBufferCleaner(Class<?> unmappableBufferClass, MethodHandle unmapper)
-