// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class ReadFileLineByLine {
    public static void main(String[] args) {
        StringBuilder strData = new StringBuilder();;
        String strLine;
        try (BufferedReader br = new BufferedReader(new FileReader("C:\\work\\loc.vbs"))) {
            while((strLine = br.readLine()) != null) {
                strData.append(strLine);
            }
            System.out.println(strData.toString());
        } catch (FileNotFoundException e) {
            System.err.println("File not found");
        } catch (IOException e) {
            System.err.println("Unable to read the file.");
        }
    }
}
