List of utility methods to do BufferedInputStream Create
InputStream | getInputStream(byte[] data) Returns input stream to decompress the data as read. ByteArrayInputStream bis = new ByteArrayInputStream(data); GZIPInputStream retval = new GZIPInputStream(bis); return retval; |
ByteArrayInputStream | getInputStream(byte[] signature) get Input Stream ByteArrayInputStream fileInput = new ByteArrayInputStream(signature); return fileInput; |
ByteArrayInputStream | getInputStream(byte[]... data) get Input Stream ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { for (byte[] d : data) { baos.write(d); } catch (IOException iex) { return new ByteArrayInputStream(baos.toByteArray()); ... |
InputStream | getInputStream(File file) get Input Stream try { return new BufferedInputStream(new FileInputStream(file)); } catch (FileNotFoundException e) { throw new IllegalStateException(e); |
InputStream | getInputStream(final String path) get Input Stream final File file = new File(getTestDataDir(), path); if (!file.isFile()) { throw new RuntimeException("File not found: " + file.getAbsolutePath()); try { return new BufferedInputStream(new FileInputStream(file)); } catch (final FileNotFoundException e) { throw new RuntimeException("File not found: " + file.getAbsolutePath()); ... |
InputStream | getInputStream(InputStream in) get Input Stream ByteArrayOutputStream out = new ByteArrayOutputStream(); int read = 0; while ((read = in.read()) != -1) { out.write(read); byte[] bytes = out.toByteArray(); in.close(); out.close(); ... |
InputStream | getInputStream(String path) Returns a InputStream from the path try { File file = new File(path); if (file != null && file.exists()) { return new BufferedInputStream(new FileInputStream(file)); return Thread.currentThread().getContextClassLoader().getResourceAsStream(path); } catch (Exception e) { e.printStackTrace(); ... |
InputStream | getInputStream(String resource) get Input Stream File f = new File(resource); if (!f.exists()) { throw new IllegalStateException("Resource not found : " + resource); FileInputStream fileInputStream = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fileInputStream, 100000 * 1024); return bis; |
InputStream | getInputStream(String string) Get an InputStream for the String. try { return new BufferedInputStream(new ByteArrayInputStream(string.getBytes(ENCODING_UTF8))); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); |
InputStream | getInputstreamForZipEntry(ZipFile zipFile, String uri) get Inputstream For Zip Entry try { ZipEntry entry = zipFile.getEntry(uri); if (entry == null) { char[] chars = uri.toCharArray(); int[] slashIndices = new int[chars.length]; int slashCount = 0; for (int i = 0; i < uri.length(); i++) { if (chars[i] == '/' || chars[i] == '\\') { ... |