@Test public void testGetStringFromStreamShouldReturnCorrectString() throws ApplicationException { String s = TEST; byte[] buffer = s.getBytes(); inputStream = new ByteArrayInputStream(buffer); String actual = underTest.getStringFromStream(inputStream); Assert.assertEquals(actual, TEST); }
public String getStringFromStream(final InputStream inputStream) throws ApplicationException { String result = ""; if (inputStream != null) { try { int extendedReadLimit = inputStream.available() + BUFFER_SIZE; inputStream.mark(extendedReadLimit); result = IOUtils.toString(inputStream); inputStream.reset(); } catch (IOException e) { throw new ApplicationException("Could not transform request input stream into string!", e); } } return result; }
InputStreamConverter { public String getStringFromStream(final InputStream inputStream) throws ApplicationException { String result = ""; if (inputStream != null) { try { int extendedReadLimit = inputStream.available() + BUFFER_SIZE; inputStream.mark(extendedReadLimit); result = IOUtils.toString(inputStream); inputStream.reset(); } catch (IOException e) { throw new ApplicationException("Could not transform request input stream into string!", e); } } return result; } }
InputStreamConverter { public String getStringFromStream(final InputStream inputStream) throws ApplicationException { String result = ""; if (inputStream != null) { try { int extendedReadLimit = inputStream.available() + BUFFER_SIZE; inputStream.mark(extendedReadLimit); result = IOUtils.toString(inputStream); inputStream.reset(); } catch (IOException e) { throw new ApplicationException("Could not transform request input stream into string!", e); } } return result; }  }
InputStreamConverter { public String getStringFromStream(final InputStream inputStream) throws ApplicationException { String result = ""; if (inputStream != null) { try { int extendedReadLimit = inputStream.available() + BUFFER_SIZE; inputStream.mark(extendedReadLimit); result = IOUtils.toString(inputStream); inputStream.reset(); } catch (IOException e) { throw new ApplicationException("Could not transform request input stream into string!", e); } } return result; }  String getStringFromStream(final InputStream inputStream); }
InputStreamConverter { public String getStringFromStream(final InputStream inputStream) throws ApplicationException { String result = ""; if (inputStream != null) { try { int extendedReadLimit = inputStream.available() + BUFFER_SIZE; inputStream.mark(extendedReadLimit); result = IOUtils.toString(inputStream); inputStream.reset(); } catch (IOException e) { throw new ApplicationException("Could not transform request input stream into string!", e); } } return result; }  String getStringFromStream(final InputStream inputStream);  }