public void load(final File file) throws IOException { checkNotNull(file); if (file.exists()) { Log.trace("Loading history from: ", file); load(new FileReader(file)); } }
public CHIA(Writer out) throws IOException { Preconditions.checkNotNull(out); this.out = out; this.automataConsole = new CHIAAutomataConsole(); this.console = new ConsoleReader(); this.console.setExpandEvents(false); console.setPrompt("CHIA> "); usage(); if (ClassLoader.getSystemResource("History.txt") != null) { console.setHistory( new FileHistory(new File(ClassLoader.getSystemResource("History.txt").getPath()))); } else { out.write("The History file cannot be loaded" + "\n"); } out.write("CHIA Started\n"); out.flush(); if (ClassLoader.getSystemResource("log4j.properties") != null) { PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties")); } else { out.write("The logging file cannot be loaded" + "\n"); } out.flush(); }
public void load(final Reader reader) throws IOException { checkNotNull(reader); BufferedReader input = new BufferedReader(reader); String item; while ((item = input.readLine()) != null) { internalAdd(item); } }
public void add(CharSequence item) { checkNotNull(item); if (isAutoTrim()) { item = String.valueOf(item).trim(); } if (isIgnoreDuplicates()) { if (!items.isEmpty() && item.equals(items.getLast())) { return; } } internalAdd(item); }
@Override protected Optional<Mapping> _call() { Preconditions.checkNotNull(entry); final File osmMapFolder = command(ResolveOSMMappingLogFolder.class).call(); File file = new File(osmMapFolder, entry.getPostMappingId().toString()); if (!file.exists()) { return Optional.absent(); } try { List<String> lines = Files.readLines(file, Charsets.UTF_8); String s = Joiner.on("\n").join(lines); Mapping mapping = Mapping.fromString(s); return Optional.of(mapping); } catch (IOException e) { throw Throwables.propagate(e); } }
public void load(final InputStream input) throws IOException { checkNotNull(input); load(new InputStreamReader(input, "UTF-8")); }