Class PdfOcrFileUtil

java.lang.Object
com.itextpdf.pdfocr.util.PdfOcrFileUtil

public final class PdfOcrFileUtil extends Object
Utility class for working with files.
  • Method Details

    • writeToTextFile

      public static void writeToTextFile (String path, String data)
      Writes provided String to text file using provided path.
      Parameters:
      path - path as String to file to be created
      data - text data in required format as String
    • getTempFilePath

      public static String getTempFilePath (String name, String extension) throws IOException
      Gets path to temp file in current system temporary directory.
      Parameters:
      name - temp file name
      extension - temp file extension
      Returns:
      path to temp file in the system temporary directory
      Throws:
      IOException - when temp file cannot be obtained
    • writeToStream

      public static void writeToStream (OutputStream stream, String data)
      Writes provided String to stream.
      Parameters:
      stream - OutputStream to write string data to
      data - text data in required format as String
    • convertToInputStreams

      public static List<InputStream> convertToInputStreams (List<File> inputImages)
      Creates list of InputStream based on given list of File.
      Parameters:
      inputImages - list of File to be used as source
      Returns:
      created list of InputStream
    • convertToOutputStream

      public static OutputStream convertToOutputStream (File file)
      Creates output stream based on given File.
      Parameters:
      file - the file to be used as output
      Returns:
      the created output stream