S3 Java client fails a lot with “Premature end of Content-Length delimited message body” or “java.net.SocketException Socket closed”
问题 I have an application that does a lot work on S3, mostly downloading files from it. I am seeing a lot of these kind of errors and I'd like to know if this is something on my code or if the service is really unreliable like this. The code I'm using to read from the S3 object stream is as follows: public static final void write(InputStream stream, OutputStream output) { byte[] buffer = new byte[1024]; int read = -1; try { while ((read = stream.read(buffer)) != -1) { output.write(buffer, 0, read