Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

load file as string java

public static String loadFileAsString(String path) {
  InputStream stream = YourClassName.class.getResourceAsStream(path);
  try {
    String result = new String(stream.readAllBytes());
    return result;
  } catch (IOException e) {
    e.printStackTrace();
    return null;
  }
}
 
PREVIOUS NEXT
Tagged: #load #file #string #java
ADD COMMENT
Topic
Name
2+3 =