Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ public class Frame extends DockerObject implements Serializable {

private final byte[] payload;

private final boolean isComplete;

public Frame(StreamType streamType, byte[] payload) {
this.streamType = streamType;
this.payload = payload;
this.isComplete = true;
}

public Frame(StreamType streamType, byte[] payload, boolean isComplete) {
this.streamType = streamType;
this.payload = payload;
this.isComplete = isComplete;
}

public StreamType getStreamType() {
Expand All @@ -28,6 +37,10 @@ public byte[] getPayload() {
return payload;
}

public boolean getIsComplete() {
return isComplete;
}

@Override
public String toString() {
return String.format("%s: %s", streamType, new String(payload).trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public void accept(DockerHttpClient.Response response) {
return;
}

bytesToRead -= readBytes;
if (readBytes == buffer.length) {
resultCallback.onNext(new Frame(streamType, buffer));
resultCallback.onNext(new Frame(streamType, buffer, bytesToRead == 0));
} else {
resultCallback.onNext(new Frame(streamType, Arrays.copyOf(buffer, readBytes)));
resultCallback.onNext(new Frame(streamType, Arrays.copyOf(buffer, readBytes), bytesToRead == 0));
}
bytesToRead -= readBytes;
} while (bytesToRead > 0);
}
} catch (Exception e) {
Expand Down