/** {@inheritDoc} */ @Override public int getFileSystemBlockSize(int fd) { FileStat stat = posix.fstat(fd); return Math.toIntExact(stat.blockSize()); }
/** {@inheritDoc} */ @Override public int getFileSystemBlockSize(Path path) { FileStat stat = posix.stat(path.toString()); return Math.toIntExact(stat.blockSize()); }
@Deprecated public RubyFixnum blksize() { checkInitialized(); return getRuntime().newFixnum(stat.blockSize()); }
@Deprecated public RubyFixnum blksize() { checkInitialized(); return getRuntime().newFixnum(stat.blockSize()); }
@JRubyMethod(name = "inspect") public IRubyObject inspect() { StringBuilder buf = new StringBuilder("#<"); buf.append(getMetaClass().getRealClass().getName()); buf.append(" "); // FIXME: Obvious issue that not all platforms can display all attributes. Ugly hacks. // Using generic posix library makes pushing inspect behavior into specific system impls // rather painful. try { buf.append("dev=0x").append(Long.toHexString(stat.dev())); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("ino=").append(stat.ino()); } catch (Exception e) {} finally { buf.append(", "); } buf.append("mode=0").append(Integer.toOctalString(stat.mode())).append(", "); try { buf.append("nlink=").append(stat.nlink()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("uid=").append(stat.uid()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("gid=").append(stat.gid()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("rdev=0x").append(Long.toHexString(stat.rdev())); } catch (Exception e) {} finally { buf.append(", "); } buf.append("size=").append(sizeInternal()).append(", "); try { buf.append("blksize=").append(stat.blockSize()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("blocks=").append(stat.blocks()); } catch (Exception e) {} finally { buf.append(", "); } buf.append("atime=").append(atime()).append(", "); buf.append("mtime=").append(mtime()).append(", "); buf.append("ctime=").append(ctime()); buf.append(">"); return getRuntime().newString(buf.toString()); }
@JRubyMethod(name = "inspect") public IRubyObject inspect() { StringBuilder buf = new StringBuilder("#<"); buf.append(getMetaClass().getRealClass().getName()); buf.append(" "); // FIXME: Obvious issue that not all platforms can display all attributes. Ugly hacks. // Using generic posix library makes pushing inspect behavior into specific system impls // rather painful. try { buf.append("dev=0x").append(Long.toHexString(stat.dev())); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("ino=").append(stat.ino()); } catch (Exception e) {} finally { buf.append(", "); } buf.append("mode=0").append(Integer.toOctalString(stat.mode())).append(", "); try { buf.append("nlink=").append(stat.nlink()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("uid=").append(stat.uid()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("gid=").append(stat.gid()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("rdev=0x").append(Long.toHexString(stat.rdev())); } catch (Exception e) {} finally { buf.append(", "); } buf.append("size=").append(sizeInternal()).append(", "); try { buf.append("blksize=").append(stat.blockSize()); } catch (Exception e) {} finally { buf.append(", "); } try { buf.append("blocks=").append(stat.blocks()); } catch (Exception e) {} finally { buf.append(", "); } buf.append("atime=").append(atime()).append(", "); buf.append("mtime=").append(mtime()).append(", "); buf.append("ctime=").append(ctime()); buf.append(">"); return getRuntime().newString(buf.toString()); }
@JRubyMethod(name = "blksize") public RubyFixnum blksize() { return getRuntime().newFixnum(stat.blockSize()); }
@JRubyMethod(name = "blksize") public IRubyObject blockSize(ThreadContext context) { checkInitialized(); if (Platform.IS_WINDOWS) return context.nil; return context.runtime.newFixnum(stat.blockSize()); }
@JRubyMethod(name = "blksize") public IRubyObject blockSize(ThreadContext context) { checkInitialized(); if (Platform.IS_WINDOWS) return context.nil; return context.runtime.newFixnum(stat.blockSize()); }
@JRubyMethod(name = "blksize") public RubyFixnum blksize() { return getRuntime().newFixnum(stat.blockSize()); }