/** * Read local file into array of strings. * * @param inputFile The input file. The file is opened using the urf-8 character set. */ protected void openFile(File inputFile) { try { openInputStream(new FileInputStream(inputFile)); textFileLoaded = true; } catch (FileNotFoundException e) { } }
/** * Create data file object from input stream. * * @param inputStream The input stream for the data file. * @param encoding Text file encoding (utf-8, 8859_1, etc.). */ public TextFile(InputStream inputStream, String encoding) { this.textFile = null; String safeEncoding = (encoding == null) ? "" : encoding; safeEncoding = safeEncoding.trim(); if (safeEncoding.length() > 0) { this.textFileEncoding = safeEncoding; } openInputStream(inputStream); }
/** * Create data file object from URL. * * @param url The input URL for the data file. * @param encoding Text file encoding (utf-8, 8859_1, etc.). */ public TextFile(URL url, String encoding) { this.textFile = null; String safeEncoding = (encoding == null) ? "" : encoding; safeEncoding = safeEncoding.trim(); if (safeEncoding.length() > 0) { this.textFileEncoding = safeEncoding; } try { openInputStream(url.openStream()); } catch (Exception e) { } }