All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.simiacryptus.skyenet.apps.general.parsers.TextReader.kt Maven / Gradle / Ivy

There is a newer version: 1.2.21
Show newest version
package com.simiacryptus.skyenet.apps.general.parsers

import com.simiacryptus.skyenet.apps.general.DocumentParserApp
import java.awt.image.BufferedImage
import java.io.File

class TextReader(private val textFile: File) : DocumentParserApp.DocumentReader {
    private val content: List = textFile.readLines()

    override fun getPageCount(): Int = 1

    override fun getText(startPage: Int, endPage: Int): String {
        return content.joinToString("\n")
    }

    override fun renderImage(pageIndex: Int, dpi: Float): BufferedImage {
        throw UnsupportedOperationException("Text files do not support image rendering")
    }

    override fun close() {
        // No resources to close for text files
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy