`is.available()` is not going to be reliable. You want `Content-Length` header (if present) and if it's not present you can wrap the `InputStream` and count the bytes.