Google Data APIs Client Library (1.41.1)



com.google.gdata.client.uploader
Class ResumableHttpFileUploader.ResponseMessage

java.lang.Object
  extended by com.google.gdata.client.uploader.ResumableHttpFileUploader.ResponseMessage
Enclosing class:
ResumableHttpFileUploader

public static class ResumableHttpFileUploader.ResponseMessage
extends java.lang.Object

The response message returned by the upload task when it has finished uploading the last chunk. The response message instance will hold the expected Content-Length header value and the InputStream returned by the HTTP connection. Note that the input stream might not be ready yet to read from when the upload task is finished. The connection might still be receiving the message body.


Constructor Summary
ResumableHttpFileUploader.ResponseMessage(int contentLength, java.io.InputStream inputStream)
           
 
Method Summary
 int getContentLength()
          Returns the value of the Content-Length header of the HTTP response.
 java.io.InputStream getInputStream()
          Returns the last request's connection's input stream to read the response body from.
 java.lang.String receiveMessage(long timeoutMs)
          Attempts to receive the entire outstanding response message body and returns it as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResumableHttpFileUploader.ResponseMessage

public ResumableHttpFileUploader.ResponseMessage(int contentLength,
                                                 java.io.InputStream inputStream)
Method Detail

getContentLength

public int getContentLength()
Returns the value of the Content-Length header of the HTTP response.

Returns:
the size of the HTTP response body in bytes.

getInputStream

public java.io.InputStream getInputStream()
Returns the last request's connection's input stream to read the response body from.

Returns:
input stream of the most recent HTTP connection.

receiveMessage

public java.lang.String receiveMessage(long timeoutMs)
                                throws java.lang.InterruptedException,
                                       java.util.concurrent.ExecutionException,
                                       java.util.concurrent.TimeoutException
Attempts to receive the entire outstanding response message body and returns it as a string.

Parameters:
timeoutMs - the maximum time to wait for the message to be received.
Returns:
the full message body as a string.
Throws:
java.lang.InterruptedException - if the task gets interrupted.
java.util.concurrent.ExecutionException - if a IOException is thrown while reading from the input stream.
java.util.concurrent.TimeoutException - if the entire message couldn't be received in the allotted timeout.