public class

StreamUtils

extends Object
java.lang.Object
   ↳ org.anddev.andengine.util.StreamUtils

Class Overview

(c) 2010 Nicolas Gramlich (c) 2011 Zynga Inc.

Summary

Constants
int IO_BUFFER_SIZE
Public Constructors
StreamUtils()
Public Methods
static void close(Closeable pCloseable)
Closes the specified stream.
static void copy(InputStream pInputStream, byte[] pData)
static void copy(InputStream pInputStream, ByteBuffer pByteBuffer)
static void copy(InputStream pInputStream, OutputStream pOutputStream)
static void copy(InputStream pInputStream, OutputStream pOutputStream, long pByteLimit)
Copy the content of the input stream into the output stream, using a temporary byte array buffer whose size is defined by IO_BUFFER_SIZE.
static boolean copyAndClose(InputStream pInputStream, OutputStream pOutputStream)
static void flushCloseStream(OutputStream pOutputStream)
Flushes and closes the specified stream.
static void flushCloseWriter(Writer pWriter)
Flushes and closes the specified stream.
final static String readFully(InputStream pInputStream)
static byte[] streamToBytes(InputStream pInputStream)
static byte[] streamToBytes(InputStream pInputStream, int pReadLimit)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int IO_BUFFER_SIZE

Constant Value: 8192 (0x00002000)

Public Constructors

public StreamUtils ()

Public Methods

public static void close (Closeable pCloseable)

Closes the specified stream.

Parameters
pCloseable The stream to close.

public static void copy (InputStream pInputStream, byte[] pData)

Throws
IOException

public static void copy (InputStream pInputStream, ByteBuffer pByteBuffer)

Throws
IOException

public static void copy (InputStream pInputStream, OutputStream pOutputStream)

Throws
IOException

public static void copy (InputStream pInputStream, OutputStream pOutputStream, long pByteLimit)

Copy the content of the input stream into the output stream, using a temporary byte array buffer whose size is defined by IO_BUFFER_SIZE.

Parameters
pInputStream The input stream to copy from.
pOutputStream The output stream to copy to.
pByteLimit not more than so much bytes to read, or unlimited if smaller than 0.
Throws
IOException If any error occurs during the copy.

public static boolean copyAndClose (InputStream pInputStream, OutputStream pOutputStream)

public static void flushCloseStream (OutputStream pOutputStream)

Flushes and closes the specified stream.

Parameters
pOutputStream The stream to close.

public static void flushCloseWriter (Writer pWriter)

Flushes and closes the specified stream.

Parameters
pWriter The Writer to close.

public static final String readFully (InputStream pInputStream)

Throws
IOException

public static byte[] streamToBytes (InputStream pInputStream)

Throws
IOException

public static byte[] streamToBytes (InputStream pInputStream, int pReadLimit)

Throws
IOException