public class StreamTool{
public static byte[] readInputStream(InputStream inputstream)throws Exception{
byte[] buffer = new byte[1024];
int len = -1;
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
while((len = inputsream.read(buffer)) != -1){
outstream.write(buffer,0,len);
}
outstream.close();
inputstream.close();
return outstream.toByteArray();
}
}