Java InputStream Create toInputStream(byte[] bytes)

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

Description

Converts an array of bytes into an Input Stream

License

Apache License

Parameter

Parameter Description
bytes the array of bytes

Return

the Input Stream

Declaration

public static InputStream toInputStream(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayInputStream;

import java.io.InputStream;

public class Main {
    /**//from w ww .  j  av  a  2 s .c o m
     * Converts an array of bytes into an Input Stream
     * 
     * @param bytes
     *          the array of bytes
     * @return the Input Stream
     */
    public static InputStream toInputStream(byte[] bytes) {

        return new ByteArrayInputStream(bytes);
    }
}

Related

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