List of utility methods to do BufferedInputStream Create
InputStream | getStream(String resource) Retrieves a resource using the current context classloader. return new BufferedInputStream( Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)); |
InputStream | getStream(String string) Gets a stream for the given string. try { return new ByteArrayInputStream(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException wontHappen) { throw new RuntimeException(wontHappen); |
InputStream | getStream(String string, String codePage) get Stream return new ByteArrayInputStream(string.getBytes(codePage)); |
InputStream | getStreamFromString(String text) get Stream From String try { byte[] bytes = text.getBytes("UTF-8"); return new ByteArrayInputStream(bytes); } catch (Exception e) { throw new AssertionError(e); |
BufferedInputStream | inputStreamBuffered(final File file) Open a buffered InputStream , equivalent to: new BufferedInputStream(new FileInputStream(file)); BufferedInputStream input = new BufferedInputStream(new FileInputStream(file)); return input; |
InputStream | toBufferedInputStream(InputStream inputStream) to Buffered Input Stream if (!(inputStream instanceof BufferedInputStream)) { inputStream = new BufferedInputStream(inputStream); return inputStream; |
InputStream | toBufferedInputStream(InputStream stream) to Buffered Input Stream if (stream instanceof BufferedInputStream) { return stream; } else { return new BufferedInputStream(stream, DEFAULT_READING_SIZE); |