Package com.itextpdf.pdfocr.util
Class PdfOcrFileUtil
java.lang.Object
com.itextpdf.pdfocr.util.PdfOcrFileUtil
Utility class for working with files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<InputStream>convertToInputStreams(List<File> inputImages) Creates list ofInputStreambased on given list ofFile.static OutputStreamconvertToOutputStream(File file) Creates output stream based on givenFile.static StringgetTempFilePath(String name, String extension) Gets path to temp file in current system temporary directory.static voidwriteToStream(OutputStream stream, String data) Writes providedStringto stream.static voidwriteToTextFile(String path, String data) Writes providedStringto text file using provided path.
-
Method Details
-
writeToTextFile
Writes providedStringto text file using provided path. -
getTempFilePath
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
Writes providedStringto stream.- Parameters:
-
stream-OutputStreamto write string data to -
data- text data in required format asString
-
convertToInputStreams
Creates list ofInputStreambased on given list ofFile.- Parameters:
-
inputImages- list ofFileto be used as source - Returns:
-
created list of
InputStream
-
convertToOutputStream
Creates output stream based on givenFile.- Parameters:
-
file- the file to be used as output - Returns:
- the created output stream
-