Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public class InputFileRead {
  2. private File readFile = null;
  3. private FileReader reader = null;
  4. private String inputFilePath = null;
  5. private final String DEFAULT_FILE_PATH = "c:\\somedirectory\\";
  6.  
  7. public InputFileRead() {
  8. inputFilePath = DEFAULT_FILE_PATH;
  9.  
  10. }
  11.  
  12. public void setInputFile(String inputFile) {
  13. /* Assume appropriate validation / encoding is used and privileges / permissions are preserved */
  14.  
  15. }
  16.  
  17. public void readInputFile() {
  18. try {
  19. reader = new FileReader(readFile);
  20. ...
  21.  
  22. } catch (RuntimeException rex) {
  23. System.err.println("Error: Cannot open input file in the directory " + inputFilePath);
  24. System.err.println("Input file has not been set, call setInputFile method before calling readInputFile");
  25.  
  26.  
  27. } catch (FileNotFoundException ex) {...}
  28.  
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement