MCPcopy Create free account
hub / github.com/GateNLP/gate-core / getGateResourceAsString

Method getGateResourceAsString

src/main/java/gate/util/Files.java:174–185  ·  view source on GitHub ↗

Get a resource from the GATE resources directory as a String. The resource name should be relative to resourcePath which is equal with gate/resources ; e.g. for a resource stored as gate/resources/jape/Test11.jape , this method should be passed the name jape/Test11.j

(String resourceName)

Source from the content-addressed store, hash-verified

172 * this method should be passed the name <TT>jape/Test11.jape</TT>.
173 */
174 public static String getGateResourceAsString(String resourceName)
175 throws IOException {
176 InputStream resourceStream = getGateResourceAsStream(resourceName);
177 if (resourceStream == null)
178 throw new IOException("No such resource on classpath: " + resourceName);
179 try {
180 return IOUtils.toString(resourceStream,Charset.defaultCharset().name());
181 }
182 finally {
183 resourceStream.close();
184 }
185 } // getGateResourceAsString(String)
186
187 /**
188 * Writes a temporary file into the default temporary directory,

Callers 2

testGetResourcesMethod · 0.95

Calls 4

closeMethod · 0.95
nameMethod · 0.80
toStringMethod · 0.65

Tested by 2

testGetResourcesMethod · 0.76