@Test public void testIsAsString() { final String expected = ""; final InputStream inputStream = new ByteArrayInputStream(expected.getBytes(UTF_8)); final DMNIOHelper dmnioHelper = new DMNIOHelper(); final String actual = dmnioHelper.isAsString(inputStream); assertEquals(expected, actual); }
public String isAsString(final InputStream inputStream) { try (final InputStream inputStreamAutoClosable = inputStream; final ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (final IOException ioe) { } return null; }
DMNIOHelper { public String isAsString(final InputStream inputStream) { try (final InputStream inputStreamAutoClosable = inputStream; final ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (final IOException ioe) { } return null; } }
DMNIOHelper { public String isAsString(final InputStream inputStream) { try (final InputStream inputStreamAutoClosable = inputStream; final ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (final IOException ioe) { } return null; }  }
DMNIOHelper { public String isAsString(final InputStream inputStream) { try (final InputStream inputStreamAutoClosable = inputStream; final ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (final IOException ioe) { } return null; }  String isAsString(final InputStream inputStream); }
DMNIOHelper { public String isAsString(final InputStream inputStream) { try (final InputStream inputStreamAutoClosable = inputStream; final ByteArrayOutputStream result = new ByteArrayOutputStream()) { final byte[] buffer = new byte[1024]; int length; while ((length = inputStreamAutoClosable.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } catch (final IOException ioe) { } return null; }  String isAsString(final InputStream inputStream);  }