Example usage for com.liferay.portal.kernel.io.unsync UnsyncBufferedInputStream UnsyncBufferedInputStream

List of usage examples for com.liferay.portal.kernel.io.unsync UnsyncBufferedInputStream UnsyncBufferedInputStream

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.io.unsync UnsyncBufferedInputStream UnsyncBufferedInputStream.

Prototype

public UnsyncBufferedInputStream(InputStream inputStream, int size) 

Source Link

Usage

From source file:com.liferay.util.axis.SimpleHTTPSender.java

License:Open Source License

private void _readFromConnection(URLConnection urlConnection, MessageContext messageContext) throws Exception {

    HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;

    InputStream inputStream = httpURLConnection.getErrorStream();

    if (inputStream == null) {
        inputStream = urlConnection.getInputStream();
    }//from  w  w  w.j ava 2 s  . com

    inputStream = new UnsyncBufferedInputStream(inputStream, 8192);

    String contentType = urlConnection.getContentType();
    String contentLocation = urlConnection.getHeaderField("Content-Location");

    Message message = new Message(inputStream, false, contentType, contentLocation);

    message.setMessageType(Message.RESPONSE);

    messageContext.setResponseMessage(message);
}