am 8cbbcb1: Merge branch \'readonly-p4-donut\' into donut

Merge commit '8cbbcb14c2d49c6d7eb9fb2d141ffd7f3d2889a2'

* commit '8cbbcb14c2d49c6d7eb9fb2d141ffd7f3d2889a2':
  AI 148378: Allow store to create BinaryTempFileBody from a preexisting file
This commit is contained in:
Andy Stadler 2009-05-06 17:57:29 -07:00 committed by The Android Open Source Project
commit 5bc1339921

View File

@ -56,6 +56,15 @@ public class BinaryTempFileBody implements Body {
}
}
/**
* An alternate way to put data into a BinaryTempFileBody is to simply supply an already-
* created file. Note that this file will be deleted after it is read.
* @param filePath The file containing the data to be stored on disk temporarily
*/
public void setFile(String filePath) {
mFile = new File(filePath);
}
public OutputStream getOutputStream() throws IOException {
mFile = File.createTempFile("body", null, mTempDirectory);
mFile.deleteOnExit();