Datasets:

ArXiv:
License:
File size: 655 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
    }

    @Override public byte[] bytes() throws IOException {
        return data;
    }
}