@Test public void testReadFileFromClasspath() throws Exception { byte[] data = Utils.readFileFromClasspath("org/hyperledger/fabric/sdk/helper/Utils.class"); Assert.assertNotNull(data); }
public static byte[] readFileFromClasspath(String fileName) throws IOException { InputStream is = Utils.class.getClassLoader().getResourceAsStream(fileName); byte[] data = ByteStreams.toByteArray(is); try { is.close(); } catch (IOException ex) { } return data; }
Utils { public static byte[] readFileFromClasspath(String fileName) throws IOException { InputStream is = Utils.class.getClassLoader().getResourceAsStream(fileName); byte[] data = ByteStreams.toByteArray(is); try { is.close(); } catch (IOException ex) { } return data; } }
Utils { public static byte[] readFileFromClasspath(String fileName) throws IOException { InputStream is = Utils.class.getClassLoader().getResourceAsStream(fileName); byte[] data = ByteStreams.toByteArray(is); try { is.close(); } catch (IOException ex) { } return data; } private  Utils(); }
Utils { public static byte[] readFileFromClasspath(String fileName) throws IOException { InputStream is = Utils.class.getClassLoader().getResourceAsStream(fileName); byte[] data = ByteStreams.toByteArray(is); try { is.close(); } catch (IOException ex) { } return data; } private  Utils(); static String generateParameterHash(String path, String func, List<String> args); static String generateDirectoryHash(String rootDir, String chaincodeDir, String hash); static byte[] generateTarGz(File sourceDirectory, String pathPrefix); static byte[] readFile(File input); static String generateUUID(); static Timestamp generateTimestamp(); static void deleteFileOrDirectory(File file); static byte[] hash(byte[] input, Digest digest); static String combinePaths(String first, String... other); static byte[] readFileFromClasspath(String fileName); static Properties parseGrpcUrl(String url); static Exception checkGrpcUrl(String url); static boolean isNullOrEmpty(String url); static String logString(final String string); static byte[] generateNonce(); static String toHexString(ByteString byteString); static String toHexString(byte[] bytes); }
Utils { public static byte[] readFileFromClasspath(String fileName) throws IOException { InputStream is = Utils.class.getClassLoader().getResourceAsStream(fileName); byte[] data = ByteStreams.toByteArray(is); try { is.close(); } catch (IOException ex) { } return data; } private  Utils(); static String generateParameterHash(String path, String func, List<String> args); static String generateDirectoryHash(String rootDir, String chaincodeDir, String hash); static byte[] generateTarGz(File sourceDirectory, String pathPrefix); static byte[] readFile(File input); static String generateUUID(); static Timestamp generateTimestamp(); static void deleteFileOrDirectory(File file); static byte[] hash(byte[] input, Digest digest); static String combinePaths(String first, String... other); static byte[] readFileFromClasspath(String fileName); static Properties parseGrpcUrl(String url); static Exception checkGrpcUrl(String url); static boolean isNullOrEmpty(String url); static String logString(final String string); static byte[] generateNonce(); static String toHexString(ByteString byteString); static String toHexString(byte[] bytes);  }