Author: mturk
Date: Fri Oct 9 17:24:52 2009
New Revision: 823625
URL: http://svn.apache.org/viewvc?rev=823625&view=rev
Log:
Add file and volume type enums
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java
(with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java
(with props)
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java?rev=823625&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java
Fri Oct 9 17:24:52 2009
@@ -0,0 +1,95 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.io;
+
+import java.util.EnumSet;
+import org.apache.commons.runtime.Descriptor;
+import org.apache.commons.runtime.Group;
+import org.apache.commons.runtime.User;
+
+/**
+ * File Information.
+ *
+ */
+public final class FileInfo
+{
+
+ private FileInfo()
+ {
+ // Created from native
+ }
+ private void setType(int ftype)
+ {
+ Type = FileType.valueOf(ftype);
+ }
+
+ /** The access permissions of the file. Mimics Unix access rights. */
+ public int Protection;
+ /**
+ * The type of file.
+ */
+ public FileType Type;
+ /**
+ * The user id that owns the file
+ */
+ public User User;
+ /**
+ * The group id that owns the file
+ */
+ public Group Group;
+ /**
+ * The number of hard links to the file.
+ */
+ public int NumLinks;
+ /**
+ * The size of the file
+ */
+ public long Size;
+ /**
+ * The storage size consumed by the file
+ */
+ public long StorageSize;
+ /**
+ * The time the file was last accessed
+ */
+ public long LastAccessTime;
+ /**
+ * The time the file was last modified
+ */
+ public long ModifiedTime;
+ /**
+ * The time the file was created, or the inode was last changed
+ */
+ public long CreatedTime;
+ /**
+ * The pathname of the file (possibly unrooted)
+ */
+ public String Name;
+ /**
+ * The file's name (no path) in filesystem case
+ */
+ public String BaseName;
+ /**
+ * The inode of the file.
+ */
+ public long InodeId;
+ /**
+ * The id of the device the file is on.
+ */
+ public long DeviceId;
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java?rev=823625&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java
Fri Oct 9 17:24:52 2009
@@ -0,0 +1,120 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.io;
+
+/**
+ * FileSystem enumeration.
+ */
+public enum FileSystemType
+{
+ /** No file type determined */
+ UNKNOWN( 0),
+ /** MS-DOS FAT */
+ MSDOS( 1),
+ /** Windows FAT32 or VFAT */
+ VFAT( 2),
+ /** NT File System */
+ NTFS( 3),
+ /** Microsoft proprietary system intended for flash drives but
+ * often called FAT64 - limit of 264 bytes (16 Exabytes)
+ */
+ FAT64( 4),
+ /** CD-ROM File System */
+ ISO9660( 5),
+ /** EXT2 File System */
+ EXT2( 6),
+ /** EXT3 File System */
+ EXT3( 7),
+ /** EXT4 File System */
+ EXT4( 9),
+ /** Extended File System (IRIX) */
+ XFS( 10),
+ /** Replacement for old Minix filesystem in Linux */
+ XIAFS( 11),
+ /** High Performance File System */
+ HPFS( 12),
+ /** Macintosh Hierarchical Filesystem */
+ HFS( 13),
+ /** Journaled filesystem (HP-UX, AIX, OS/2 5, Linux) */
+ JFS( 14),
+ /** Rom filesystem */
+ ROMFS( 15),
+ /** Universal Disk Format (DVD-ROM filesystem) */
+ UDF( 16),
+ /**
+ * Native filesystem for most BSD unixes
+ * (FreeBSD, NetBSD, OpenBSD, Sun Solaris, ...).
+ */
+ FFS( 17),
+ /**
+ * Secure File System. FSF filesystem type is a variation
+ * of the FFS filesystem type.
+ */
+ SFS( 18),
+ /** Network filesystem */
+ NFS( 19),
+ /** Solaris Zone filesystem */
+ ZFS( 20),
+ /** RAM filesystem */
+ RAMFS( 21),
+ /** Raiser filesystem */
+ RAISERFS( 22),
+ /** New version of Raiser filesystem */
+ RAISER4( 23),
+ /** Device filesystem */
+ DEV( 24),
+ /** Proc filesystem */
+ PROC( 25),
+ /** Sys filesystem */
+ SYSFS( 26),
+ /** Temp filesystem */
+ TMPFS( 27),
+ /** RPC filesystem */
+ RPC( 28),
+ /** USB filesystem */
+ USBFS( 29),
+ /** VMware guest filesystem */
+ VMHGFS( 30),
+ /** VMware VMCI filesystem */
+ VMBLOCK( 31),
+ /** Swap filesystem */
+ SWAP( 32),
+
+ /** File system is mounted to nothing */
+ NONE( 1000);
+
+ private int value;
+ private FileSystemType(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static FileSystemType valueOf(int value)
+ {
+ for (FileSystemType e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileSystemType.java
------------------------------------------------------------------------------
svn:eol-style = native
|