Example usage for java.io ByteArrayInputStream ByteArrayInputStream

List of usage examples for java.io ByteArrayInputStream ByteArrayInputStream

Introduction

In this page you can find the example usage for java.io ByteArrayInputStream ByteArrayInputStream.

Prototype

public ByteArrayInputStream(byte buf[]) 

Source Link

Document

Creates a ByteArrayInputStream so that it uses buf as its buffer array.

Usage

From source file:Main.java

public static InputStream String2Inputstream(String str) {
    return new ByteArrayInputStream(str.getBytes());
}

From source file:Main.java

public static InputStream string2Inputstream(String str) {
    return new ByteArrayInputStream(str.getBytes());
}

From source file:Main.java

public static Bitmap loadFromBytes(byte[] bytes) {
    ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    return BitmapFactory.decodeStream(inputStream);
}

From source file:Main.java

static public Object setObjectBytes(byte[] b) throws IOException, ClassNotFoundException {
    ByteArrayInputStream baos = new ByteArrayInputStream(b);
    ObjectInputStream oos = new ObjectInputStream(baos);
    oos.close();/*from w ww  . ja v a 2 s . c  o  m*/
    return oos.readObject();
}

From source file:Main.java

public static InputStream getInputStream(String str) {
    InputStream inputStream = new ByteArrayInputStream(str.getBytes());
    return inputStream;
}

From source file:Main.java

public static InputStream stringToInputStream(String str) {
    InputStream is = new ByteArrayInputStream(str.getBytes());
    return is;

}

From source file:Main.java

public static InputStream byte2InputStream(byte[] b) {
    ByteArrayInputStream bais = new ByteArrayInputStream(b);
    return bais;//  w  ww . j a v  a  2  s  . c  om
}

From source file:Main.java

public static InputStream Byte2InputStream(byte[] b) {
    ByteArrayInputStream bais = new ByteArrayInputStream(b);
    return bais;//from ww w.  ja v a  2 s.c om
}

From source file:Main.java

public static byte[] decompressGZIP(byte bytes[]) throws IOException {
    ByteArrayInputStream is = new ByteArrayInputStream(bytes);
    GZIPInputStream gzipis = new GZIPInputStream(is);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    int i;//from ww w  .  ja v  a2 s  . c  o m
    while ((i = gzipis.read()) != -1) {
        os.write(i);
    }
    gzipis.close();
    os.close();
    return os.toByteArray();
}

From source file:Main.java

public static InputStream String2InputStream(String str) {
    ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes());
    return stream;
}