Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana committed Jul 3, 2020
1 parent d6a3aee commit c08b372
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 63 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/io/minio/GenericResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import okhttp3.Headers;

/** Generic response class of any APIs. */
public abstract class GenericResponse {
public class GenericResponse {
private Headers headers;
private String bucket;
private String region;
Expand Down
67 changes: 5 additions & 62 deletions api/src/main/java/io/minio/GetObjectResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@

package io.minio;

import java.io.IOException;
import java.io.InputStream;
import java.io.FilterInputStream;
import okhttp3.Headers;

public class GetObjectResponse extends InputStream {
private BaseResponse response;
private InputStream body;
public class GetObjectResponse extends FilterInputStream {
private GenericResponse response;

public GetObjectResponse(
Headers headers, String bucket, String region, String object, InputStream body) {
this.response = new BaseResponse(headers, bucket, region, object);
this.body = body;
super(body);
this.response = new GenericResponse(headers, bucket, region, object);
}

public Headers headers() {
Expand All @@ -45,59 +43,4 @@ public String region() {
public String object() {
return response.object();
}

public InputStream body() {
return body;
}

@Override
public int available() throws IOException {
return body.available();
}

@Override
public void close() throws IOException {
body.close();
}

@Override
public void mark(int readlimit) {
body.mark(readlimit);
}

@Override
public boolean markSupported() {
return body.markSupported();
}

@Override
public int read() throws IOException {
return body.read();
}

@Override
public int read(byte[] b) throws IOException {
return body.read(b);
}

@Override
public int read(byte[] b, int off, int len) throws IOException {
return body.read(b, off, len);
}

@Override
public void reset() throws IOException {
body.reset();
}

@Override
public long skip(long n) throws IOException {
return body.skip(n);
}

private static class BaseResponse extends GenericResponse {
public BaseResponse(Headers headers, String bucket, String region, String object) {
super(headers, bucket, region, object);
}
}
}

0 comments on commit c08b372

Please sign in to comment.