I am trying to publish a large video/image file from the local file system to an http path, but I run into an out of memory error after some time...
here is the code
conn.setFixedLengthStreamingMode((int) new File(localpath).length());
And for buffering you could cover your streams into the BufferedOutputStream and BufferedInputStream
Good example of chunked uploading you could find there: gdata-java-client