Revision 56854
Added by Alessia Bardi over 4 years ago
DataciteESIterator.java | ||
---|---|---|
46 | 46 |
startRequest(); |
47 | 47 |
} |
48 | 48 |
|
49 |
private static String decompression(final Result r) { |
|
49 |
protected static String decompression(final Result r) { |
|
50 |
return decompression(r.getBody().getBytes()); |
|
51 |
} |
|
52 |
|
|
53 |
protected static String decompression(final byte[] bodyBytes){ |
|
50 | 54 |
try { |
51 |
byte[] byteArray = Base64.decodeBase64(r.getBody().getBytes());
|
|
55 |
byte[] byteArray = Base64.decodeBase64(bodyBytes);
|
|
52 | 56 |
Inflater decompresser = new Inflater(); |
53 | 57 |
decompresser.setInput(byteArray); |
54 | 58 |
ByteArrayOutputStream bos = new ByteArrayOutputStream(byteArray.length); |
... | ... | |
65 | 69 |
log.warn("Exception when decompressing: "+e.getMessage()); |
66 | 70 |
return null; |
67 | 71 |
} |
68 |
|
|
69 | 72 |
} |
70 | 73 |
|
71 | 74 |
private void fillQueue(final String hits) { |
Also available in: Unified diff
Test DataciteESIterator's decompression method