package innovimax.mixthem.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

/**
* <p>Reads lines from a character-input file.</p>
* <p>This is the default implementation of IInputLine.</p>
* @see IInputLine
* @author Innovimax
* @version 1.0
*/
public class DefaultLineReader implements IInputLine {

	private final BufferedReader reader;

	/**
 	* Creates a line reader from a file.
 	* @param input The input file to be read 	
 	* @throws IOException - If an I/O error occurs
 	*/
	public DefaultLineReader(File input) throws IOException {
		this.reader = Files.newBufferedReader(input.toPath(), StandardCharsets.UTF_8);		
	}
	
	/**
 	* Creates a line reader from an input stream.
 	* @param input The input stream to be read 	
 	* @throws IOException - If an I/O error occurs
 	*/
	public DefaultLineReader(InputStream input) throws IOException {
	        this.reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
	}
	
	@Override
	public boolean hasLine() throws IOException {
		return this.reader.ready();
	}

	@Override
	public String nextLine() throws IOException {
		String line = null;
		if (hasLine()) {
			line = this.reader.readLine();
		}
		return line;
	}

	@Override
	public void close() throws IOException {
		this.reader.close();
	}

}

@@ -542,312 +542,24 @@
 om a
- file.%0A %09* @param input The input file to be read %09%0A %09* @throws IOException - If an I/O error occurs%0A %09*/%0A%09public DefaultLineReader(File input) throws IOException %7B%0A%09%09this.reader = Files.newBufferedReader(input.toPath(), StandardCharsets.UTF_8);%09%09%0A%09%7D%0A%09%0A%09/**%0A %09* Creates a line reader from an input stream
+n input resource
 .%0A %09
@@ -587,14 +587,16 @@
 put 
-stream
+resource
  to 
@@ -690,22 +690,24 @@
 er(Input
-Stream
+Resource
  input) 
@@ -732,16 +732,9 @@
  %7B%0A%09
-        
+%09
 this
@@ -743,20 +743,25 @@
 eader = 
+input.
 new
- 
 Buffered
@@ -771,60 +771,8 @@
 der(
-new InputStreamReader(input, StandardCharsets.UTF_8)
 );%0A%09

Update DefaultLineReader.java