public static InputStream[] copy(InputStream inputStream) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ByteArrayOutputStream outputStream2 = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, length);
outputStream2.write(buffer, 0, length);
}
outputStream.flush();
return new InputStream[]{new ByteArrayInputStream(outputStream.toByteArray()),new ByteArrayInputStream(outputStream2.toByteArray())};
}
InputStream[] copiedInputStream = copy(inputStream);