@Test public void shouldReadBytesFromResource() throws IOException { byte[] bytes = Util.readResourceBytes("/pdf_implementation.pdf"); a(bytes.length).shouldBeEqual(174230); }
public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } }
Util { public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } } }
Util { public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } } private  Util(); }
Util { public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } } private  Util(); static byte[] readResourceBytes(String resourceName); static String readResource(String resourceName); static String readResource(String resourceName, String charset); static String readFile(String fileName); static String readFile(String fileName, String charset); static void closeQuietly(AutoCloseable autoCloseable); static void closeQuietly(AutoCloseable ... autoCloseable); static void closeQuietly(List<T> autoCloseable); static String read(InputStream in); static String read(InputStream in, String charset); static byte[] bytes(InputStream in); static byte[] read(File file); static List<String> getResourceLines(String resourceName); static boolean blank(Object value); static boolean empty(Object[] array); static boolean empty(Collection<?> collection); static String join(String[] array, String delimiter); static String[] split(String input, String delimiters); static String[] split(String input, char delimiter); static String join(Collection<?> collection, String delimiter); static void join(StringBuilder sb, Collection<?> collection, String delimiter); static void join(StringBuilder sb, Object[] array, String delimiter); static void repeat(StringBuilder sb, String str, int count); static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count); static void saveTo(String path, InputStream in); static String getCauseMessage(Throwable throwable); static String getStackTraceString(Throwable throwable); static void saveTo(String path, byte[] content); static String toBase64(byte[] input); static byte[] fromBase64(String input); String[] arr(String ... params); static Properties readProperties(String fileOrResource); static boolean createTree(Path path); static void recursiveDelete(Path directory); }
Util { public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } } private  Util(); static byte[] readResourceBytes(String resourceName); static String readResource(String resourceName); static String readResource(String resourceName, String charset); static String readFile(String fileName); static String readFile(String fileName, String charset); static void closeQuietly(AutoCloseable autoCloseable); static void closeQuietly(AutoCloseable ... autoCloseable); static void closeQuietly(List<T> autoCloseable); static String read(InputStream in); static String read(InputStream in, String charset); static byte[] bytes(InputStream in); static byte[] read(File file); static List<String> getResourceLines(String resourceName); static boolean blank(Object value); static boolean empty(Object[] array); static boolean empty(Collection<?> collection); static String join(String[] array, String delimiter); static String[] split(String input, String delimiters); static String[] split(String input, char delimiter); static String join(Collection<?> collection, String delimiter); static void join(StringBuilder sb, Collection<?> collection, String delimiter); static void join(StringBuilder sb, Object[] array, String delimiter); static void repeat(StringBuilder sb, String str, int count); static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count); static void saveTo(String path, InputStream in); static String getCauseMessage(Throwable throwable); static String getStackTraceString(Throwable throwable); static void saveTo(String path, byte[] content); static String toBase64(byte[] input); static byte[] fromBase64(String input); String[] arr(String ... params); static Properties readProperties(String fileOrResource); static boolean createTree(Path path); static void recursiveDelete(Path directory);  }