use of org.apache.commons.httpclient.ChunkedInputStream in project kcanotify by antest1.
the class KcaUtils method unchunkdata.
public static byte[] unchunkdata(byte[] contentBytes) throws IOException {
byte[] unchunkedData = null;
byte[] buffer = new byte[1024];
ByteArrayInputStream bis = new ByteArrayInputStream(contentBytes);
ChunkedInputStream cis = new ChunkedInputStream(bis);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int read = -1;
while ((read = cis.read(buffer)) != -1) {
bos.write(buffer, 0, read);
}
unchunkedData = bos.toByteArray();
bos.close();
return unchunkedData;
}
Aggregations