You're doing buffered IO, so you can't usually depend on reading complete transfers from your source. InputStream.available() tells you that *some* bytes are available, and you read them, emptying...