"stream" says it all. how long is a stream anyway? i would just like the last 3000 liters of water from that stream that runs by my house, please. where do the last 3000 liters begin?
there is a java method relating to the length of an inputstream, but java itself says the call is not reliable. if your job depends on getting this right, you might not want to rely on it.
you have to consume the inputstream, and then you can step 3000 bytes from the end. depending on the length of the stream, you might be able to do it in memory. you'll probably have to save it to a file, as you've been doing. you can then access 3000 bytes from the end of the file with random access.