While it is not clear from the Buffer documentation, the Reader *interface* 
documentation (which Buffer.Read implements implicitly) does state "up to 
len(p) bytes." You are ignoring how many bytes it read and assuming that 
the one read is reading the whole file. I am not sure that this is 
guaranteed with Buffer.Read. 

I would suggest you try to adhere to the Reader interface's documented 
behavior, and continue to call Read until you get EOF, and process the n 
returned bytes each time. Doing this would also make it easier to then move 
a step further and drop your buffer size to something sensible, instead of 
attempting to read the entire 2.5G file into memory before compressing.

Howard

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to