diff options
author | Elliott Hughes <enh@google.com> | 2011-05-27 16:34:56 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2011-05-27 16:34:56 -0700 |
commit | 5722fb8a3c56310ad3e9394e7bd9bb0fd17917a9 (patch) | |
tree | 7f5a6dbc26edf637f1d622bb2170fea335b314ca | |
parent | 2ab014f88b412ceb4a0593d0934edb536ef1baa8 (diff) | |
download | libcore-5722fb8a3c56310ad3e9394e7bd9bb0fd17917a9.zip libcore-5722fb8a3c56310ad3e9394e7bd9bb0fd17917a9.tar.gz libcore-5722fb8a3c56310ad3e9394e7bd9bb0fd17917a9.tar.bz2 |
Fix the FileOutputStream documentation.
The O_CREAT|O_TRUNC behavior was not fully documented.
Change-Id: I0ea16ec3ea032c4f0572e8900316469f448edb75
-rw-r--r-- | luni/src/main/java/java/io/FileOutputStream.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/luni/src/main/java/java/io/FileOutputStream.java b/luni/src/main/java/java/io/FileOutputStream.java index cc57571..69f9235 100644 --- a/luni/src/main/java/java/io/FileOutputStream.java +++ b/luni/src/main/java/java/io/FileOutputStream.java @@ -66,9 +66,9 @@ public class FileOutputStream extends OutputStream implements Closeable { private final CloseGuard guard = CloseGuard.get(); /** - * Constructs a new {@code FileOutputStream} that writes to {@code file}. + * Constructs a new {@code FileOutputStream} that writes to {@code file}. The file will be + * truncated if it exists, and created if it doesn't exist. * - * @param file the file to which this stream writes. * @throws FileNotFoundException if file cannot be opened for writing. */ public FileOutputStream(File file) throws FileNotFoundException { @@ -76,12 +76,10 @@ public class FileOutputStream extends OutputStream implements Closeable { } /** - * Constructs a new {@code FileOutputStream} that writes to {@code file}, - * creating it if necessary. If {@code append} is true and the file already - * exists, it will be appended to. Otherwise a new file will be created. + * Constructs a new {@code FileOutputStream} that writes to {@code file}. + * If {@code append} is true and the file already exists, it will be appended to; otherwise + * it will be truncated. The file will be created if it does not exist. * - * @param file the file to which this stream writes. - * @param append true to append to an existing file. * @throws FileNotFoundException if the file cannot be opened for writing. */ public FileOutputStream(File file, boolean append) throws FileNotFoundException { @@ -97,7 +95,6 @@ public class FileOutputStream extends OutputStream implements Closeable { /** * Constructs a new {@code FileOutputStream} that writes to {@code fd}. * - * @param fd the FileDescriptor to which this stream writes. * @throws NullPointerException if {@code fd} is null. */ public FileOutputStream(FileDescriptor fd) { @@ -113,14 +110,21 @@ public class FileOutputStream extends OutputStream implements Closeable { } /** - * Equivalent to {@code new FileOutputStream(new File(path), false)}. + * Constructs a new {@code FileOutputStream} that writes to {@code path}. The file will be + * truncated if it exists, and created if it doesn't exist. + * + * @throws FileNotFoundException if file cannot be opened for writing. */ public FileOutputStream(String path) throws FileNotFoundException { this(path, false); } /** - * Equivalent to {@code new FileOutputStream(new File(path), append)}. + * Constructs a new {@code FileOutputStream} that writes to {@code path}. + * If {@code append} is true and the file already exists, it will be appended to; otherwise + * it will be truncated. The file will be created if it does not exist. + * + * @throws FileNotFoundException if the file cannot be opened for writing. */ public FileOutputStream(String path, boolean append) throws FileNotFoundException { this(new File(path), append); |