Datasets:
ArXiv:
License:
| package httpcli; | |
| import java.io.ByteArrayInputStream; | |
| import java.io.IOException; | |
| public class BytesResponseBody extends ResponseBody { | |
| public final byte[] data; | |
| public BytesResponseBody(ResponseBody body, byte[] data) { | |
| super(new ByteArrayInputStream(data)); | |
| this.data = data; | |
| this.request = body.request; | |
| this.code = body.code; | |
| this.headers = body.headers; | |
| this.contentLength = body.contentLength; | |
| this.contentEncoding = body.contentEncoding; | |
| this.contentType = body.contentType; | |
| } | |
| public byte[] bytes() throws IOException { | |
| return data; | |
| } | |
| } | |