IoUtils { public static byte[] readBytesFromInputStream(InputStream input) throws IOException { return readBytesFromInputStream( input, true ); }  static int findPort(); static boolean validPort(int port); static String readFileAsString(File file); static void copyFile(File sourceFile, File destFile); static long copy( InputStream input, OutputStream output ); static File copyInTempFile( InputStream input, String fileExtension ); static List<String> recursiveListFile(File folder); static List<String> recursiveListFile(File folder, String prefix, Predicate<File> filter); static byte[] readBytesFromInputStream(InputStream input); static byte[] readBytesFromInputStream(InputStream input, boolean closeInput); static byte[] readBytesFromZipEntry(File file, ZipEntry entry); static byte[] readBytes(File f); static void write(File f,
                             byte[] data); static void writeBytes(File f, byte[] data); static boolean areByteArraysEqual(byte[] b1,
                                             byte[] b2); static String asSystemSpecificPath(String urlPath, int colonIndex); static final Charset UTF8_CHARSET; }
@Test public void testReadEmptyStream() throws IOException { byte[] bytes = IoUtils.readBytesFromInputStream( new ReaderInputStream( new StringReader( "" ) ) ); assertEquals(0, bytes.length); }