@Test public void testStreamToString() throws IOException { String text = "Hello World\n\tasdasdasdas"; String text2 = "Han Solo is the best star wars character"; File file = File.createTempFile("TEST", ".txt"); file.deleteOnExit(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(text); writer.flush(); FileInputStream inputStream = new FileInputStream(file); String readString = BulldogUtil.convertStreamToString(inputStream); TestCase.assertEquals(text, readString); readString = BulldogUtil.convertStreamToString(inputStream); TestCase.assertEquals("", readString); writer.write(text2); writer.flush(); readString = BulldogUtil.convertStreamToString(inputStream); TestCase.assertEquals(text2, readString); inputStream.close(); readString = BulldogUtil.convertStreamToString(inputStream); TestCase.assertEquals("", readString); writer.close(); }
@SuppressWarnings("resource") public static String convertStreamToString(java.io.InputStream is) { Scanner s = new Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; }
BulldogUtil { @SuppressWarnings("resource") public static String convertStreamToString(java.io.InputStream is) { Scanner s = new Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } }
BulldogUtil { @SuppressWarnings("resource") public static String convertStreamToString(java.io.InputStream is) { Scanner s = new Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; }  }
BulldogUtil { @SuppressWarnings("resource") public static String convertStreamToString(java.io.InputStream is) { Scanner s = new Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; }  static void sleepMs(int ms); static void sleepNs(int ns); static String bytesToString(byte[] bytes, String encoding); static String bytesToString(byte[] bytes); @SuppressWarnings("resource") static String convertStreamToString(java.io.InputStream is); static String readFileAsString(String path); static boolean isStringNumeric(String str); static final int getUnsignedByte(byte b); }
BulldogUtil { @SuppressWarnings("resource") public static String convertStreamToString(java.io.InputStream is) { Scanner s = new Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; }  static void sleepMs(int ms); static void sleepNs(int ns); static String bytesToString(byte[] bytes, String encoding); static String bytesToString(byte[] bytes); @SuppressWarnings("resource") static String convertStreamToString(java.io.InputStream is); static String readFileAsString(String path); static boolean isStringNumeric(String str); static final int getUnsignedByte(byte b);  }