Examples of FileStat


Examples of ch.cern.mig.posix.FileStat

        // store the queue unique identifier
        if (System.getProperty("os.name").startsWith("Windows")) {
            id = queuePath;
        } else {
            // set id to stat->st_dev + stat->st_ino
            FileStat stat = posix.stat(queuePath);
            id = "" + stat.dev() + ":" + stat.ino();
        }
    }
View Full Code Here

Examples of ch.cern.mig.posix.FileStat

                File[] inElements = element.listFiles(new RegExpFilenameFilter(
                        Pattern.compile("\\."), false));
                if (inElements == null)
                    continue;
                for (File inElement : inElements) {
                    FileStat stat = null;
                    try {
                        stat = posix.stat(inElement.getPath());
                    } catch (LastErrorException e) {
                        if (Posix.getErrorCode(e) == BasePosix.ENOENT)
                            continue;
                        throw new IOException(String.format(
                                "cannot stat(%s): %s", inElement,
                                e.getMessage()));
                    }
                    if (inElement.getName().endsWith(TEMPORARY_SUFFIX)
                            && stat.mtime() >= oldtemp)
                        continue;
                    if (inElement.getName().endsWith(LOCKED_SUFFIX)
                            && stat.mtime() >= oldlock)
                        continue;
                    warn("removing too old volatile file: " + inElement);
                    try {
                        posix.unlink(inElement.getPath());
                    } catch (LastErrorException e) {
View Full Code Here

Examples of ch.cern.mig.posix.FileStat

        // store the queue unique identifier
        if (System.getProperty("os.name").startsWith("Windows")) {
            id = queuePath;
        } else {
            // set id to stat->st_dev + stat->st_ino
            FileStat stat = posix.stat(queuePath);
            id = "" + stat.dev() + ":" + stat.ino();
        }
    }
View Full Code Here

Examples of ch.cern.mig.posix.FileStat

                File[] inElements = element.listFiles(new RegExpFilenameFilter(
                        Pattern.compile("\\."), false));
                if (inElements == null)
                    continue;
                for (File inElement : inElements) {
                    FileStat stat = null;
                    try {
                        stat = posix.stat(inElement.getPath());
                    } catch (LastErrorException e) {
                        if (Posix.getErrorCode(e) == BasePosix.ENOENT)
                            continue;
                        throw new IOException(String.format(
                                "cannot stat(%s): %s", inElement,
                                e.getMessage()));
                    }
                    if (inElement.getName().endsWith(TEMPORARY_SUFFIX)
                            && stat.mtime() >= oldtemp)
                        continue;
                    if (inElement.getName().endsWith(LOCKED_SUFFIX)
                            && stat.mtime() >= oldlock)
                        continue;
                    warn("removing too old volatile file: " + inElement);
                    try {
                        posix.unlink(inElement.getPath());
                    } catch (LastErrorException e) {
View Full Code Here

Examples of ch.cern.mig.posix.FileStat

    // store the queue unique identifier
    if (System.getProperty("os.name").startsWith("Windows")) {
      id = queuePath;
    } else {
      // set id to stat->st_dev + stat->st_ino
      FileStat stat = posix.stat(queuePath);
      id = "" + stat.dev() + ":" + stat.ino();
    }
  }
View Full Code Here

Examples of com.google.appengine.api.files.FileStat

  @Override
  public void finishObjectCreation(RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis)
      throws IOException {
    Token t = append(token, chunk);
    FILES.openWriteChannel(t.file, true).closeFinally();
    FileStat stats = FILES.stat(t.file);
    Entity e = new Entity(makeKey(t.filename));
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    try (ObjectOutputStream oout = new ObjectOutputStream(bout)) {
      oout.writeObject(t.options);
    }
    e.setUnindexedProperty(OPTIONS_PROP, new Blob(bout.toByteArray()));
    e.setUnindexedProperty(CREATION_TIME_PROP, System.currentTimeMillis());
    e.setUnindexedProperty(FILE_LENGTH_PROP, stats.getLength());
    DATASTORE.put(null, e);
  }
View Full Code Here

Examples of jnr.posix.FileStat

                    if (extendedFilename != null) return extendedFilename;
                    continue;
                }

                try {
                    FileStat stat = posix.stat(filename);
                    if (!executableOnly || (!stat.isDirectory() && stat.isExecutable())) return filename;
                } catch (Throwable t) {}
            }
        }
       
        return null;
View Full Code Here

Examples of jnr.posix.FileStat

                   
                    if (extendedFilename != null) return extendedFilename;
                    continue;
                }
               
                FileStat stat = posix.allocateStat();
                int value = posix.libc().stat(filename, stat);
                if (value >= 0) {
                    if (!executableOnly) return filename;
                   
                    if (!stat.isDirectory() && stat.isExecutable()) {
                        return filename;
                    }
                }
            }
        }
View Full Code Here

Examples of jnr.posix.FileStat

                    new IRubyObject[]{runtime.newString(filename), runtime.newString("w")}, Block.NULL_BLOCK));
        }

        private void inplaceEdit(ThreadContext context, String filename, String extension) throws RaiseException {
            File file = new File(filename);
            FileStat stat = runtime.getPosix().stat(filename);

            if (!extension.equals("")) {
                file.renameTo(new File(filename + extension));
            } else {
                file.delete();
            }

            createNewFile(file);

            runtime.getPosix().chmod(filename, stat.mode());
            runtime.getPosix().chown(filename, stat.uid(), stat.gid());
            runtime.getGlobalVariables().set("$stdout", (RubyIO) RubyFile.open(context, runtime.getFile(),
                    new IRubyObject[]{runtime.newString(filename), runtime.newString("w")}, Block.NULL_BLOCK));
        }
View Full Code Here

Examples of jnr.posix.FileStat

        if ((openFile.getMode() & OpenFile.WRITABLE) != 0) {
            flush();
        }

        try {
            FileStat stat = runtime.getPosix().fstat(
                    getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor());
            if (stat == null) {
                throw runtime.newErrnoEACCESError(path);
            }

            return runtime.newFixnum(stat.st_size());
        } catch (BadDescriptorException e) {
            throw runtime.newErrnoEBADFError();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.