Skip to content

Commit

Permalink
test resource class path
Browse files Browse the repository at this point in the history
  • Loading branch information
juliomarcopineda committed Mar 2, 2018
1 parent 2fa6cbf commit ad8fd02
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions peptideSerumStability/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions peptideSerumStability/resources/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
I am a resource file!
You are reading me!
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.juliomarcopineda;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class ResourceTest {

public static void main(String[] args) {
InputStream test = ResourceTest.class.getResourceAsStream("/test.txt");

BufferedReader reader = new BufferedReader(new InputStreamReader(test));

String line;
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

0 comments on commit ad8fd02

Please sign in to comment.