I am using FileInputStream in Spring MVC to read a chunk of a file into a byte[] buffer.
I then write (using FileCopyUtils.copy) the buffer to the response stream.
I notice that the response that is written to the stream (what the user receives) looks similar to the file, but there are blemishes.
- before the file data, there is a ‘2000’ (without quotes) at the top of the file.
- this ‘2000’ string is sporadically present throughout my file
- The file ends with a ‘0’
none of these exist in the original file that is being read from. Can anyone help me get rid of these so that I have an accurate output stream?
here’s an example of what my incorrect ouput looks like:
2000
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
a line o
2000
f data
a line of data
2000
a line of data
a line of data
0
it should just be:
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
a line of data
Thanks!
my guess is that the stream is specified as a chunked transfer encoding and your simply reading it as is