java.io.File.isInvalid()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(1085)

本文整理了Java中java.io.File.isInvalid()方法的一些代码示例,展示了File.isInvalid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.isInvalid()方法的具体详情如下:
包路径:java.io.File
类名称:File
方法名:isInvalid

File.isInvalid介绍

暂无

代码示例

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean renameTo(File dest) {
  if (dest == null) throw new NullPointerException();
  if (this.isInvalid() || dest.isInvalid()) return false;
  return fs.rename(this, dest);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean setWritable(boolean writable, boolean ownerOnly) {
  if (isInvalid()) return false;
  return fs.setPermission(this, FileSystem.ACCESS_WRITE, writable, ownerOnly);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean canExecute() {
  if (isInvalid()) return false;
  return fs.checkAccess(this, FileSystem.ACCESS_EXECUTE);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean canWrite() {
  if (isInvalid()) return false;
  return fs.checkAccess(this, FileSystem.ACCESS_WRITE);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean isFile() {
  if (isInvalid()) return false;
  return ((fs.getBooleanAttributes(this) & FileSystem.BA_REGULAR) != 0);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public String[] list() {
  if (isInvalid()) return null;
  return fs.list(this);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean canRead() {
  if (isInvalid()) return false;
  return fs.checkAccess(this, FileSystem.ACCESS_READ);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public long length() {
  if (isInvalid()) return 0L;
  return fs.getLength(this);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean delete() {
  if (isInvalid()) return false;
  return fs.delete(this);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean setReadOnly() {
  if (isInvalid()) return false;
  return fs.setReadOnly(this);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean setExecutable(boolean executable, boolean ownerOnly) {
  if (isInvalid()) return false;
  return fs.setPermission(this, FileSystem.ACCESS_EXECUTE, executable, ownerOnly);
}

代码示例来源:origin: com.jtransc/jtransc-rt

@Deprecated
public URL toURL() throws MalformedURLException {
  if (isInvalid()) throw new MalformedURLException("Invalid file path");
  return new URL("file", "", slashify(getAbsolutePath(), isDirectory()));
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean setLastModified(long time) {
  if (time < 0) throw new IllegalArgumentException("Negative time");
  if (isInvalid()) return false;
  return fs.setLastModifiedTime(this, time);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean isHidden() {
  if (isInvalid()) return false;
  return ((fs.getBooleanAttributes(this) & FileSystem.BA_HIDDEN) != 0);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean setReadable(boolean readable, boolean ownerOnly) {
  if (isInvalid()) return false;
  return fs.setPermission(this, FileSystem.ACCESS_READ, readable, ownerOnly);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public long getFreeSpace() {
  if (isInvalid()) return 0L;
  return fs.getSpace(this, FileSystem.SPACE_FREE);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public long getUsableSpace() {
  if (isInvalid()) return 0L;
  return fs.getSpace(this, FileSystem.SPACE_USABLE);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public boolean mkdir() {
  if (isInvalid()) return false;
  return fs.createDirectory(this);
}

代码示例来源:origin: com.jtransc/jtransc-rt

public String getCanonicalPath() throws IOException {
  if (isInvalid()) throw new IOException("Invalid file path");
  return fs.canonicalize(fs.resolve(this));
}

代码示例来源:origin: com.jtransc/jtransc-rt

public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  String name = (file != null ? file.getPath() : null);
  if (name == null) throw new NullPointerException();
  if (file.isInvalid()) throw new FileNotFoundException("Invalid file path");
  this.fd = new FileDescriptor();
  this.append = append;
  this.path = name;
  jfd = JTranscSyncIO.impl.open(name, JTranscSyncIO.O_RDWR);
  if (append) {
    jfd.setPosition(jfd.getLength());
  }
}

相关文章