001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Emil Ong
028: */
029:
030: package com.caucho.vfs;
031:
032: public class FileStatus {
033: private static long S_IFMT = 00170000;
034: private static long S_IFSOCK = 0140000;
035: private static long S_IFLNK = 0120000;
036: private static long S_IFREG = 0100000;
037: private static long S_IFBLK = 0060000;
038: private static long S_IFDIR = 0040000;
039: private static long S_IFCHR = 0020000;
040: private static long S_IFIFO = 0010000;
041:
042: private long _st_dev;
043: private long _st_ino;
044: private int _st_mode;
045: private int _st_nlink;
046: private int _st_uid;
047: private int _st_gid;
048: private long _st_rdev;
049: private long _st_size;
050: private long _st_blksize;
051: private long _st_blocks;
052: private long _st_atime;
053: private long _st_mtime;
054: private long _st_ctime;
055:
056: private boolean _isRegularFile;
057: private boolean _isDirectory;
058: private boolean _isCharacterDevice;
059: private boolean _isBlockDevice;
060: private boolean _isFIFO;
061: private boolean _isLink;
062: private boolean _isSocket;
063:
064: public FileStatus(long st_dev, long st_ino, int st_mode,
065: int st_nlink, int st_uid, int st_gid, long st_rdev,
066: long st_size, long st_blksize, long st_blocks,
067: long st_atime, long st_mtime, long st_ctime,
068: boolean isRegularFile, boolean isDirectory,
069: boolean isCharacterDevice, boolean isBlockDevice,
070: boolean isFIFO, boolean isLink, boolean isSocket) {
071: _st_dev = st_dev;
072: _st_ino = st_ino;
073: _st_mode = st_mode;
074: _st_nlink = st_nlink;
075: _st_uid = st_uid;
076: _st_gid = st_gid;
077: _st_rdev = st_rdev;
078: _st_size = st_size;
079: _st_blksize = st_blksize;
080: _st_blocks = st_blocks;
081: _st_atime = st_atime;
082: _st_mtime = st_mtime;
083: _st_ctime = st_ctime;
084:
085: _isRegularFile = isRegularFile;
086: _isDirectory = isDirectory;
087: _isCharacterDevice = isCharacterDevice;
088: _isBlockDevice = isBlockDevice;
089: _isFIFO = isFIFO;
090: _isLink = isLink;
091: _isSocket = isSocket;
092: }
093:
094: public long getDev() {
095: return _st_dev;
096: }
097:
098: public long getIno() {
099: return _st_ino;
100: }
101:
102: public int getMode() {
103: return _st_mode;
104: }
105:
106: public int getNlink() {
107: return _st_nlink;
108: }
109:
110: public int getUid() {
111: return _st_uid;
112: }
113:
114: public int getGid() {
115: return _st_gid;
116: }
117:
118: public long getRdev() {
119: return _st_rdev;
120: }
121:
122: public long getSize() {
123: return _st_size;
124: }
125:
126: public long getBlksize() {
127: return _st_blksize;
128: }
129:
130: public long getBlocks() {
131: return _st_blocks;
132: }
133:
134: public long getAtime() {
135: return _st_atime;
136: }
137:
138: public long getMtime() {
139: return _st_mtime;
140: }
141:
142: public long getCtime() {
143: return _st_ctime;
144: }
145:
146: public boolean isRegularFile() {
147: return _isRegularFile;
148: }
149:
150: public boolean isDirectory() {
151: return _isDirectory;
152: }
153:
154: public boolean isCharacterDevice() {
155: return _isCharacterDevice;
156: }
157:
158: public boolean isBlockDevice() {
159: return _isBlockDevice;
160: }
161:
162: public boolean isFIFO() {
163: return _isFIFO;
164: }
165:
166: public boolean isLink() {
167: return _isLink;
168: }
169:
170: public boolean isSocket() {
171: return _isSocket;
172: }
173: }
|