Example usage for com.liferay.portal.kernel.util StreamUtil transfer

List of usage examples for com.liferay.portal.kernel.util StreamUtil transfer

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StreamUtil transfer.

Prototype

public static void transfer(InputStream inputStream, OutputStream outputStream, int bufferSize, boolean cleanUp)
            throws IOException 

Source Link

Usage

From source file:com.liferay.petra.log4j.Log4JUtil.java

License:Open Source License

/**
 * @see com.liferay.portal.util.FileImpl#getBytes(InputStream, int, boolean)
 *//* w  ww. j ava  2 s .c om*/
private static byte[] _getBytes(InputStream inputStream) throws IOException {

    UnsyncByteArrayOutputStream unsyncByteArrayOutputStream = new UnsyncByteArrayOutputStream();

    StreamUtil.transfer(inputStream, unsyncByteArrayOutputStream, -1, true);

    return unsyncByteArrayOutputStream.toByteArray();
}