Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
skoulouzis committed May 22, 2017
1 parent ddb0582 commit 7afa64c
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions utility/src/main/java/eu/edisonproject/utility/file/ConfigHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,63 +34,63 @@
*/
public class ConfigHelper {

public static CharArraySet loadStopWords(String stopWordsPath) {
ReaderFile fileReader = new ReaderFile(stopWordsPath);
String[] stopWord = fileReader.readFile().split(" ");
final List<String> stopWords = Arrays.asList(stopWord);
public static CharArraySet loadStopWords(String stopWordsPath) {
ReaderFile fileReader = new ReaderFile(stopWordsPath);
String[] stopWord = fileReader.readFile().split(" ");
final List<String> stopWords = Arrays.asList(stopWord);

return new CharArraySet(stopWords, false);
}

public static CharArraySet loadStopWords(InputStream is) throws IOException {
String line;
List<String> stopWords = new ArrayList<>();
try (BufferedReader br = new BufferedReader(
new InputStreamReader(is))) {
while ((line = br.readLine()) != null) {
stopWords.add(line);
}
return new CharArraySet(stopWords, false);
}

return new CharArraySet(stopWords, false);
}
public static CharArraySet loadStopWords(InputStream is) throws IOException {
String line;
List<String> stopWords = new ArrayList<>();
try (BufferedReader br = new BufferedReader(
new InputStreamReader(is))) {
while ((line = br.readLine()) != null) {
stopWords.add(line);
}
}

return new CharArraySet(stopWords, false);
}

public static MyProperties getProperties(String propertiesPath) throws IOException {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.INFO, "Reading properties from: {0}", propertiesPath);
InputStream in = null;
try {
if (new File(propertiesPath).exists() && new File(propertiesPath).isFile()) {
in = new FileInputStream(propertiesPath);
} else {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
in = classLoader.getResourceAsStream(propertiesPath);
}
MyProperties properties = new MyProperties();
properties.load(in);
return properties;
} catch (IOException ex) {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (in != null) {
in.close();
}
public static MyProperties getProperties(String propertiesPath) throws IOException {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.INFO, "Reading properties from: {0}", propertiesPath);
InputStream in = null;
try {
if (new File(propertiesPath).exists() && new File(propertiesPath).isFile()) {
in = new FileInputStream(propertiesPath);
} else {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
in = classLoader.getResourceAsStream(propertiesPath);
}
MyProperties properties = new MyProperties();
properties.load(in);
return properties;
} catch (IOException ex) {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (in != null) {
in.close();
}
}
return null;
}
return null;
}

public static MyProperties getProperties(InputStream in) throws IOException {
try {
MyProperties properties = new MyProperties();
properties.load(in);
return properties;
} catch (IOException ex) {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (in != null) {
in.close();
}
public static MyProperties getProperties(InputStream in) throws IOException {
try {
MyProperties properties = new MyProperties();
properties.load(in);
return properties;
} catch (IOException ex) {
Logger.getLogger(ConfigHelper.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if (in != null) {
in.close();
}
}
return null;
}
return null;
}

}

0 comments on commit 7afa64c

Please sign in to comment.