(warc) Minor code clean-up.
Remove redundant String$getBytes(). This is mainly an improvement in code consistency.
This commit is contained in:
parent
ba26f6ce84
commit
e66d0b7431
@ -14,11 +14,6 @@ class WarcDigestBuilder {
|
|||||||
this.digest = MessageDigest.getInstance(digestAlgorithm);
|
this.digest = MessageDigest.getInstance(digestAlgorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(String s) {
|
|
||||||
byte[] bytes = s.getBytes();
|
|
||||||
update(bytes, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(byte[] bytes) {
|
public void update(byte[] bytes) {
|
||||||
update(bytes, bytes.length);
|
update(bytes, bytes.length);
|
||||||
}
|
}
|
||||||
|
@ -145,14 +145,16 @@ public class WarcRecorder implements AutoCloseable {
|
|||||||
|
|
||||||
WarcDigestBuilder requestDigestBuilder = new WarcDigestBuilder();
|
WarcDigestBuilder requestDigestBuilder = new WarcDigestBuilder();
|
||||||
|
|
||||||
String httpRequestString = WarcProtocolReconstructor.getHttpRequestString(response.request(), requestUri);
|
byte[] httpRequestString = WarcProtocolReconstructor
|
||||||
|
.getHttpRequestString(response.request(), requestUri)
|
||||||
|
.getBytes();
|
||||||
|
|
||||||
requestDigestBuilder.update(httpRequestString);
|
requestDigestBuilder.update(httpRequestString);
|
||||||
|
|
||||||
WarcRequest warcRequest = new WarcRequest.Builder(requestUri)
|
WarcRequest warcRequest = new WarcRequest.Builder(requestUri)
|
||||||
.blockDigest(requestDigestBuilder.build())
|
.blockDigest(requestDigestBuilder.build())
|
||||||
.date(date)
|
.date(date)
|
||||||
.body(MediaType.HTTP_REQUEST, httpRequestString.getBytes())
|
.body(MediaType.HTTP_REQUEST, httpRequestString)
|
||||||
.concurrentTo(warcResponse.id())
|
.concurrentTo(warcResponse.id())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -322,7 +324,7 @@ public class WarcRecorder implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ResponseDataBuffer {
|
private static class ResponseDataBuffer {
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
private int length = 0;
|
private int length = 0;
|
||||||
private int pos = 0;
|
private int pos = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user