Java InputStream Create toInputStream(byte[] data)

Here you can find the source of toInputStream(byte[] data)

Description

converts the byte array to an input stream

License

Open Source License

Declaration

public static InputStream toInputStream(byte[] data) 

Method Source Code


//package com.java2s;
/*/*  w w w  .  j a v  a 2 s .  c o m*/
 * JBoss, Home of Professional Open Source.
 *
 * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
 *
 * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
 */

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;

import java.io.InputStream;

public class Main {
    /**
      * converts the byte array to an input stream 
      */
    public static InputStream toInputStream(byte[] data) {
        ByteArrayInputStream bais = new ByteArrayInputStream(data);
        InputStream isContent = new BufferedInputStream(bais);

        return isContent;

    }
}

Related

  1. inputStreamFromPath(String path)
  2. InputStreamFromString(String str)
  3. newInputStream(Class clazz, String filename)
  4. newInputStreamReader(InputStream is)
  5. toInputStream(byte[] bytes)
  6. toInputStream(CharSequence input)
  7. toInputStream(CharSequence input, String encoding)
  8. toInputStream(CharSequence input, String encoding)
  9. toInputStream(File file)