List of usage examples for java.io FileReader ready
public boolean ready() throws IOException
From source file:cfd.backupper.state.StartupConfig.java
private static JSONObject deserializeConfFile() { JSONObject jsonObject = new JSONObject(); JSONParser jsonParser = new JSONParser(); try {/*www .j a v a2 s .c o m*/ FileReader fr = new FileReader(confFile); if (fr.ready()) { jsonObject = (JSONObject) jsonParser.parse(fr); return jsonObject; } } catch (FileNotFoundException ex) { Logger.getLogger(StartupConfig.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException | ParseException ex) { Logger.getLogger(StartupConfig.class.getName()).log(Level.SEVERE, null, ex); } return jsonObject; }
From source file:org.eclipse.php.internal.ui.preferences.NewPHPManualSiteDialog.java
private String detectCHMLanguageSuffix(String chmFile) { StringBuilder suffix = new StringBuilder("::/"); //$NON-NLS-1$ char[] buf = new char[8192]; try {/*from w w w . jav a 2 s . c om*/ FileReader r = new FileReader(chmFile); try { while (r.ready()) { r.read(buf); Matcher m = LANG_DETECT_PATTERN.matcher(new String(buf)); if (m.find()) { suffix.append(m.group(1)); break; } } } finally { r.close(); } } catch (Exception e) { } return suffix.toString(); }