<dependency>
<groupId>com.paperinput</groupId>
<artifactId>paperinput-core</artifactId>
<version>1.0.0</version>
</dependency>
import com.paperinput.StreamInput;
import com.paperinput.ReaderInput;
public class InputProcessor {
public void processInputFromStream(InputStream inputStream) {
StreamInput streamInput = new StreamInput(inputStream);
String line;
while ((line = streamInput.readLine()) != null) {
}
streamInput.close();
}
public void processInputFromReader(Reader reader) {
ReaderInput readerInput = new ReaderInput(reader);
String line;
while ((line = readerInput.readLine()) != null) {
}
readerInput.close();
}
}
import java.io.FileInputStream;
import java.io.FileReader;
public class Main {
public static void main(String[] args) {
try (InputStream inputStream = new FileInputStream("input.txt")) {
InputProcessor inputProcessor = new InputProcessor();
inputProcessor.processInputFromStream(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
try (Reader reader = new FileReader("input.txt")) {
InputProcessor inputProcessor = new InputProcessor();
inputProcessor.processInputFromReader(reader);
} catch (IOException e) {
e.printStackTrace();
}
}
}