Skip to content

Commit ddab1c7

Browse files
author
Stephane Landelle
committed
Minor clean up
1 parent cf6509a commit ddab1c7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/main/java/com/ning/http/multipart/MultipartBody.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ public long read(ByteBuffer buffer) throws IOException {
7979
int overallLength = 0;
8080

8181
final int maxLength = buffer.remaining();
82-
if (maxLength <= 0) {
83-
return maxLength;
84-
}
8582

8683
if (startPart == parts.size() && endWritten) {
8784
return -1;
@@ -208,7 +205,8 @@ public long read(ByteBuffer buffer) throws IOException {
208205
private void initializeByteArrayBody(FilePart filePart)
209206
throws IOException {
210207

211-
ByteArrayOutputStream output = generateByteArrayBody(filePart);
208+
ByteArrayOutputStream output = new ByteArrayOutputStream();
209+
filePart.sendData(output);
212210

213211
initializeBuffer(output);
214212

@@ -397,13 +395,6 @@ private long handleByteArrayPart(WritableByteChannel target,
397395
return writeToTarget(target, output);
398396
}
399397

400-
private ByteArrayOutputStream generateByteArrayBody(FilePart filePart)
401-
throws IOException {
402-
final ByteArrayOutputStream output = new ByteArrayOutputStream();
403-
filePart.sendData(output);
404-
return output;
405-
}
406-
407398
private long handleFileEnd(WritableByteChannel target, FilePart filePart)
408399
throws IOException {
409400

0 commit comments

Comments
 (0)