public InputStream run() { if (iLoader != null) { return iLoader.getResourceAsStream(path); } else { return ClassLoader.getSystemResourceAsStream(path); } } });
public Object run() { ClassLoader threadCL = getContextClassLoader(); if (threadCL != null) { return threadCL.getResourceAsStream(name); } else { return ClassLoader.getSystemResourceAsStream(name); } } });
public Object run() { if (loader != null) { return loader.getResourceAsStream(name); } else { return ClassLoader.getSystemResourceAsStream(name); } } });
protected static InputStream getResourceAsStream(ClassLoader loader, String name) { if (loader != null) { return loader.getResourceAsStream(name); } else { return ClassLoader.getSystemResourceAsStream(name); } }
/** * Constructs a new {@link ClassReader} object. * * @param name the fully qualified name of the class to be read. * @throws IOException if an exception occurs during reading. */ public ClassReader(final String name) throws IOException { this(ClassLoader.getSystemResourceAsStream(name.replace('.', '/') + ".class")); }
public InputStream run() { if (iLoader != null) { return iLoader.getResourceAsStream(path); } else { return ClassLoader.getSystemResourceAsStream(path); } } });
public InputStream run() { ClassLoader threadCL = getContextClassLoader(); if (threadCL != null) { return threadCL.getResourceAsStream(name); } else { return ClassLoader.getSystemResourceAsStream(name); } } });
public InputStream run() { if (iLoader != null) { return iLoader.getResourceAsStream(path); } else { return ClassLoader.getSystemResourceAsStream(path); } } });
/** * Constructs a new {@link ClassReader} object. * * @param className the fully qualified name of the class to be read. The ClassFile structure is * retrieved with the current class loader's {@link ClassLoader#getSystemResourceAsStream}. * @throws IOException if an exception occurs during reading. */ public ClassReader(final String className) throws IOException { this( readStream( ClassLoader.getSystemResourceAsStream(className.replace('.', '/') + ".class"), true)); }
public InputStream run() { ClassLoader threadCL = Thread.currentThread().getContextClassLoader(); if (threadCL != null) { return threadCL.getResourceAsStream(CONFIGURATION_FILE); } else { return ClassLoader.getSystemResourceAsStream(CONFIGURATION_FILE); } } });
private static void loadProperties() { try { properties.load(ClassLoader.getSystemResourceAsStream("benchmark.properties")); } catch (IOException e) { e.printStackTrace(); } }
/** * Constructs a new {@link ClassReader} object. * * @param className the fully qualified name of the class to be read. The ClassFile structure is * retrieved with the current class loader's {@link ClassLoader#getSystemResourceAsStream}. * @throws IOException if an exception occurs during reading. */ public ClassReader(final String className) throws IOException { this( readStream( ClassLoader.getSystemResourceAsStream(className.replace('.', '/') + ".class"), true)); }
/** * This implementation opens an InputStream for the given class path resource. * @see java.lang.ClassLoader#getResourceAsStream(String) * @see java.lang.Class#getResourceAsStream(String) */ @Override public InputStream getInputStream() throws IOException { InputStream is; if (this.clazz != null) { is = this.clazz.getResourceAsStream(this.path); } else if (this.classLoader != null) { is = this.classLoader.getResourceAsStream(this.path); } else { is = ClassLoader.getSystemResourceAsStream(this.path); } if (is == null) { throw new FileNotFoundException(getDescription() + " cannot be opened because it does not exist"); } return is; }
private static String readResourceAsString( String resource ) { return readAsString( ClassLoader.getSystemResourceAsStream( resource ) ); }
/** * Constructs a new {@link ClassReader} object. * * @param className the fully qualified name of the class to be read. The ClassFile structure is * retrieved with the current class loader's {@link ClassLoader#getSystemResourceAsStream}. * @throws IOException if an exception occurs during reading. */ public ClassReader(final String className) throws IOException { this( readStream( ClassLoader.getSystemResourceAsStream(className.replace('.', '/') + ".class"), true)); }
@Test public void testConcatResultSet() { InputStream stream = ClassLoader.getSystemResourceAsStream("issue_191.json"); String concatResult = JsonPath.parse(stream).read("$.concat($..state)", String.class); assertEquals("Expected a string length to be a concat of all of the states", concatResult.length(), 806); }
@Test public void testConcatWithNumericValueAsString() { InputStream stream = ClassLoader.getSystemResourceAsStream("issue_191.json"); String concatResult = JsonPath.parse(stream).read("$.concat($..cpus)", String.class); assertEquals("Expected a string length to be a concat of all of the cpus", concatResult.length(), 489); } }
@Test public void testResultSetNumericComputation() { InputStream stream = ClassLoader.getSystemResourceAsStream("issue_191.json"); Long value = JsonPath.parse(stream).read("$.sum($..timestamp)", Long.class); assertEquals("Expected the max function to consume the aggregation parameters and calculate the max over the result set", Long.valueOf(35679716813L), value); }
@Test public void testResultSetNumericComputationRecursiveReplacement() { InputStream stream = ClassLoader.getSystemResourceAsStream("issue_191.json"); Long value = JsonPath.parse(stream).read("$.max($..timestamp.avg(), $..timestamp.stddev())", Long.class); assertEquals("Expected the max function to consume the aggregation parameters and calculate the max over the result set", Long.valueOf(1427188672L), value); }
@Test public void testResultSetNumericComputationTail() { InputStream stream = ClassLoader.getSystemResourceAsStream("issue_191.json"); Long value = JsonPath.parse(stream).read("$..timestamp.sum()", Long.class); assertEquals("Expected the max function to consume the aggregation parameters and calculate the max over the result set", Long.valueOf(35679716813L), value); }