/** * Returns the time when this file was last modified, measured in * milliseconds since January 1st, 1970, midnight. * Returns 0 if the file does not exist. * * @return the time when this file was last modified. */ public long lastModified() { try { return Libcore.os.stat(path).st_mtime * 1000L; } catch (ErrnoException errnoException) { // The RI returns 0 on error. (Even for errors like EACCES or ELOOP.) return 0; } }
/** * Returns the length of this file in bytes. * Returns 0 if the file does not exist. * The result for a directory is not defined. * * @return the number of bytes in this file. */ public long length() { try { return Libcore.os.stat(path).st_size; } catch (ErrnoException errnoException) { // The RI returns 0 on error. (Even for errors like EACCES or ELOOP.) return 0; } }
public StructStat stat(String path) throws ErrnoException { return os.stat(path); } public StructStatVfs statvfs(String path) throws ErrnoException { return os.statvfs(path); }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Indicates if this file represents a <em>file</em> on the underlying * file system. * * @return {@code true} if this file is a file, {@code false} otherwise. */ public boolean isFile() { try { return S_ISREG(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }
/** * Indicates if this file represents a <em>directory</em> on the * underlying file system. * * @return {@code true} if this file is a directory, {@code false} * otherwise. */ public boolean isDirectory() { try { return S_ISDIR(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }
/** * Returns the time when this file was last modified, measured in * milliseconds since January 1st, 1970, midnight. * Returns 0 if the file does not exist. * * @return the time when this file was last modified. */ public long lastModified() { try { return Libcore.os.stat(path).st_mtime * 1000L; } catch (ErrnoException errnoException) { // The RI returns 0 on error. (Even for errors like EACCES or ELOOP.) return 0; } }
public StructStat stat(String path) throws ErrnoException { return os.stat(path); } public StructStatVfs statvfs(String path) throws ErrnoException { return os.statvfs(path); }
/** * Returns the length of this file in bytes. * Returns 0 if the file does not exist. * The result for a directory is not defined. * * @return the number of bytes in this file. */ public long length() { try { return Libcore.os.stat(path).st_size; } catch (ErrnoException errnoException) { // The RI returns 0 on error. (Even for errors like EACCES or ELOOP.) return 0; } }
public StructStat stat(String path) throws ErrnoException { return os.stat(path); } public StructStatVfs statvfs(String path) throws ErrnoException { return os.statvfs(path); }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean doChmod(int mask, boolean set) { try { StructStat sb = Libcore.os.stat(path); int newMode = set ? (sb.st_mode | mask) : (sb.st_mode & ~mask); Libcore.os.chmod(path, newMode); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Indicates if this file represents a <em>file</em> on the underlying * file system. * * @return {@code true} if this file is a file, {@code false} otherwise. */ public boolean isFile() { try { return S_ISREG(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }
/** * Indicates if this file represents a <em>file</em> on the underlying * file system. * * @return {@code true} if this file is a file, {@code false} otherwise. */ public boolean isFile() { try { return S_ISREG(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }
/** * Indicates if this file represents a <em>directory</em> on the * underlying file system. * * @return {@code true} if this file is a directory, {@code false} * otherwise. */ public boolean isDirectory() { try { return S_ISDIR(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }
/** * Indicates if this file represents a <em>file</em> on the underlying * file system. * * @return {@code true} if this file is a file, {@code false} otherwise. */ public boolean isFile() { try { return S_ISREG(Libcore.os.stat(path).st_mode); } catch (ErrnoException errnoException) { // The RI returns false on error. (Even for errors like EACCES or ELOOP.) return false; } }