You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/10/23 10:21:17 UTC
svn commit: r828963 -
/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java
Author: mturk
Date: Fri Oct 23 08:21:16 2009
New Revision: 828963
URL: http://svn.apache.org/viewvc?rev=828963&view=rev
Log:
See what to do with FileInstance
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java?rev=828963&r1=828962&r2=828963&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java Fri Oct 23 08:21:16 2009
@@ -39,107 +39,4 @@
// No instance
}
- /**
- * The "standard" input stream {@code FileStream}.
- */
- public static final FileStream STDIN;
- /**
- * The "standard" output stream {@code FileStream}.
- */
- public static final FileStream STDOUT;
- /**
- * The "standard" error stream {@code FileStream}.
- */
- public static final FileStream STDERR;
-
- static {
- /* Initialize the "standard" FileStream.
- * Note that those descriptors can be NULL in
- * case the FileStream.open call fails.
- */
- STDIN = new FileStreamImpl(FileWrapper.open(0, null));
- STDOUT = new FileStreamImpl(FileWrapper.open(1, null));
- STDERR = new FileStreamImpl(FileWrapper.open(2, null));
- }
-
- /**
- * Create new {@code FileStream} that is bound to the spacified standard
- * I/O device (standard input, standard output, or standard error).
- * <p>
- * FileInstance returned can be used by applications that need to
- * read from or write to the console. If the standard handle is redirected
- * the returned {@code FileStream} is pointer to that redirected file.
- * </p>
- * <p>
- * If the application doesn't have standard handles (e.g. daemon applicaton)
- * and the handles are not redirected, the returned {@code FileStream}
- * contains invalid file {@code Descriptor}. Any further operation on such
- * {@code FileStream} will fail with {@link ClosedDescriptorException}.
- * </p>
- * <p>
- * Parameter {@code which} determines which one of the stadard streams to
- * open and can have the following values:
- * <p>
- * <pre>
- * 0 "standard" input stream.
- * 1 "standard" output stream.
- * 2 "standard" error stream.
- * </pre>
- * @param which standard stream to open.
- *
- * @return new {@code FileStream} connected to standard stream.
- *
- */
- public static FileStream createStdStream(int which,
- EnumSet<FileOpenMode> mode)
- throws IllegalArgumentException
- {
- if (which < 0 || which > 2) {
- throw new IllegalArgumentException();
- }
- Descriptor fd = FileWrapper.open(which, mode);
- return new FileStreamImpl(fd);
- }
-
- public static FileStream createStdStream(int which,
- FileOpenMode... mode)
- throws IllegalArgumentException
- {
- return createStdStream(which, FileOpenMode.of(mode));
- }
-
- /**
- * Create new temporary file inside {@code directory}.
- *
- * @param prefix temporary file prefix.
- *
- * @return new temporary file {@code Descriptor}.
- */
- public static Descriptor createTemp(String prefix, String suffix,
- Path directory, boolean preserve)
- throws IOException, IllegalArgumentException, SecurityException
- {
- if (prefix == null) {
- throw new IllegalArgumentException();
- }
- return FileWrapper.mktemp(directory, prefix, suffix, preserve);
- }
-
- /**
- * Create new temporary file inside current directory.
- *
- * @param prefix file prefix.
- *
- * @return new temporary file {@code Descriptor}.
- */
- public static Descriptor createTemp(String prefix, String suffix,
- boolean preserve)
- throws IOException, IllegalArgumentException, SecurityException
- {
- if (prefix == null) {
- throw new IllegalArgumentException();
- }
- return FileWrapper.mktemp(prefix, suffix, preserve);
- }
-
}