Module org.sejda.io

Class IOUtils

java.lang.Object
org.sejda.io.util.IOUtils

public final class IOUtils extends Object
Utility class with I/O related static methods
  • Field Details

  • Constructor Details

    • IOUtils

      private IOUtils()
  • Method Details

    • unmap

      public static void unmap(ByteBuffer buf)
      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

      private static Consumer<ByteBuffer> unmapper()
      This is adapted from org.apache.lucene.store.MMapDirectory
      Returns:
    • newBufferCleaner

      private static Consumer<ByteBuffer> newBufferCleaner(Class<?> unmappableBufferClass, MethodHandle unmapper)