Java Utililty Methods BufferedInputStream Create

List of utility methods to do BufferedInputStream Create

Description

The list of methods to do BufferedInputStream Create are organized into topic(s).

Method

InputStreamgetInputStream(byte[] data)
Returns input stream to decompress the data as read.
ByteArrayInputStream bis = new ByteArrayInputStream(data);
GZIPInputStream retval = new GZIPInputStream(bis);
return retval;
ByteArrayInputStreamgetInputStream(byte[] signature)
get Input Stream
ByteArrayInputStream fileInput = new ByteArrayInputStream(signature);
return fileInput;
ByteArrayInputStreamgetInputStream(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());
...
InputStreamgetInputStream(File file)
get Input Stream
try {
    return new BufferedInputStream(new FileInputStream(file));
} catch (FileNotFoundException e) {
    throw new IllegalStateException(e);
InputStreamgetInputStream(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());
...
InputStreamgetInputStream(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();
...
InputStreamgetInputStream(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();
...
InputStreamgetInputStream(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;
InputStreamgetInputStream(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);
InputStreamgetInputstreamForZipEntry(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] == '\\') {
...