throw new IllegalArgumentException(
"Upload contentLength is too big.");
}
- mUploadContentLength = (int)contentLength;
+ mUploadContentLength = (int) contentLength;
mPostContentType = contentType;
mPostDataChannel = channel;
mPostData = null;
@Override
public void setHttpMethod(String method) {
validateNotStarted();
- if (!("PUT".equals(method) || "POST".equals(method))) {
- throw new IllegalArgumentException(
- "Only PUT and POST are allowed.");
- }
mMethod = method;
}
}
URL url = new URL(mUrl);
- mConnection = (HttpURLConnection)url.openConnection();
+ mConnection = (HttpURLConnection) url.openConnection();
// If configured, use the provided http verb.
if (mMethod != null) {
try {
continue;
} else {
mSkippingToOffset = false;
- start = (int)(mOffset - (mSize - size));
+ start = (int) (mOffset - (mSize - size));
count -= start;
}
}
if (mContentLengthLimit != 0 && mSize > mContentLengthLimit) {
- count -= (int)(mSize - mContentLengthLimit);
+ count -= (int) (mSize - mContentLengthLimit);
if (count > 0) {
mSink.write(ByteBuffer.wrap(buffer, start, count));
}
}
@Override
+ public String getNegotiatedProtocol() {
+ return "";
+ }
+
+ @Override
public int getHttpStatusCode() {
int httpStatusCode = mHttpStatusCode;
*/
@Override
public ByteBuffer getByteBuffer() {
- return ((ChunkedWritableByteChannel)mSink).getByteBuffer();
+ return ((ChunkedWritableByteChannel) mSink).getByteBuffer();
}
@Override
public byte[] getResponseAsBytes() {
- return ((ChunkedWritableByteChannel)mSink).getBytes();
+ return ((ChunkedWritableByteChannel) mSink).getBytes();
}
@Override