1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package libcore.io; 18 19 /** 20 * File information returned by fstat(2), lstat(2), and stat(2). Corresponds to C's 21 * {@code struct stat} from 22 * <a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html"><stat.h></a> 23 */ 24 public final class StructStat { 25 /** Device ID of device containing file. */ 26 public final long st_dev; /*dev_t*/ 27 28 /** File serial number (inode). */ 29 public final long st_ino; /*ino_t*/ 30 31 /** Mode (permissions) of file. */ 32 public final int st_mode; /*mode_t*/ 33 34 /** Number of hard links to the file. */ 35 public final long st_nlink; /*nlink_t*/ 36 37 /** User ID of file. */ 38 public final int st_uid; /*uid_t*/ 39 40 /** Group ID of file. */ 41 public final int st_gid; /*gid_t*/ 42 43 /** Device ID (if file is character or block special). */ 44 public final long st_rdev; /*dev_t*/ 45 46 /** 47 * For regular files, the file size in bytes. 48 * For symbolic links, the length in bytes of the pathname contained in the symbolic link. 49 * For a shared memory object, the length in bytes. 50 * For a typed memory object, the length in bytes. 51 * For other file types, the use of this field is unspecified. 52 */ 53 public final long st_size; /*off_t*/ 54 55 /** Time of last access. */ 56 public final long st_atime; /*time_t*/ 57 58 /** Time of last data modification. */ 59 public final long st_mtime; /*time_t*/ 60 61 /** Time of last status change. */ 62 public final long st_ctime; /*time_t*/ 63 64 /** 65 * A file system-specific preferred I/O block size for this object. 66 * For some file system types, this may vary from file to file. 67 */ 68 public final long st_blksize; /*blksize_t*/ 69 70 /** Number of blocks allocated for this object. */ 71 public final long st_blocks; /*blkcnt_t*/ 72 73 StructStat(long st_dev, long st_ino, int st_mode, long st_nlink, int st_uid, int st_gid, 74 long st_rdev, long st_size, long st_atime, long st_mtime, long st_ctime, 75 long st_blksize, long st_blocks) { 76 this.st_dev = st_dev; 77 this.st_ino = st_ino; 78 this.st_mode = st_mode; 79 this.st_nlink = st_nlink; 80 this.st_uid = st_uid; 81 this.st_gid = st_gid; 82 this.st_rdev = st_rdev; 83 this.st_size = st_size; 84 this.st_atime = st_atime; 85 this.st_mtime = st_mtime; 86 this.st_ctime = st_ctime; 87 this.st_blksize = st_blksize; 88 this.st_blocks = st_blocks; 89 } 90 } 91