Author: mladen.turk(a)jboss.com
Date: 2007-10-29 04:12:38 -0400 (Mon, 29 Oct 2007)
New Revision: 1148
Modified:
trunk/sight/java/org/jboss/sight/File.java
Log:
Add open and close File methods
Modified: trunk/sight/java/org/jboss/sight/File.java
===================================================================
--- trunk/sight/java/org/jboss/sight/File.java 2007-10-29 08:02:45 UTC (rev 1147)
+++ trunk/sight/java/org/jboss/sight/File.java 2007-10-29 08:12:38 UTC (rev 1148)
@@ -138,8 +138,7 @@
throws NullPointerException, OperatingSystemException
{
super(0);
- create0(INSTANCE, name, FileMode.bitmapOf(flags),
- FileProtection.bitmapOf(perm));
+ open(name, flags, perm);
}
/**
@@ -178,11 +177,57 @@
throws NullPointerException, OperatingSystemException
{
super(parent.POOL);
+ open(name, flags, perm);
+ }
+
+ /**
+ * Open the specified file.
+ * @param name The full path to the file (using / on all systems)
+ * @param flags Or'ed value of:
+ * <PRE>
+ * APR_FOPEN_READ open for reading
+ * APR_FOPEN_WRITE open for writing
+ * APR_FOPEN_CREATE create the file if not there
+ * APR_FOPEN_APPEND file ptr is set to end prior to all writes
+ * APR_FOPEN_TRUNCATE set length to zero if file exists
+ * APR_FOPEN_BINARY not a text file (This flag is ignored on
+ * UNIX because it has no meaning)
+ * APR_FOPEN_BUFFERED buffer the data. Default is non-buffered
+ * APR_FOPEN_EXCL return error if APR_FOPEN_CREATE and file exists
+ * APR_FOPEN_DELONCLOSE delete the file after closing.
+ * APR_FOPEN_XTHREAD Platform dependent tag to open the file
+ * for use across multiple threads
+ * APR_FOPEN_SHARELOCK Platform dependent support for higher
+ * level locked read/write access to support
+ * writes across process/machines
+ * APR_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics
+ * for sendfile operations. Advisory only,
+ * apr_socket_sendfile does not check this flag.
+ * </PRE>
+ * @param perm Access permissions for file.
+ * <P>
+ * If perm is OS_DEFAULT and the file is being created,
+ * appropriate default permissions will be used.
+ * </P>
+ */
+ public void open(String name, EnumSet<FileMode> flags,
+ EnumSet<FileProtection> perm)
+ throws NullPointerException, OperatingSystemException
+ {
create0(INSTANCE, name, FileMode.bitmapOf(flags),
FileProtection.bitmapOf(perm));
}
/**
+ * Close the File.
+ * This is synonim for destroy method
+ */
+ public void close()
+ {
+ destroy();
+ }
+
+ /**
* Create a temporary file
* @param template The template to use when creating a temp file.
* @param flags The flags to open the file with. If this is zero,
Show replies by date