Package org.terrier.utility.io

Examples of org.terrier.utility.io.FileSystem.capabilities()


  {
    filename = transform(filename);
    final FileSystem fs = getFileSystem(filename);
    if (fs == null)
      throw new FileNotFoundException("No file system for "+filename);
    if ((fs.capabilities() & FSCapability.RANDOM_WRITE) == 0)
      throw new IOException("File system not supporting random writes for "+ filename);
    return fs.writeFileRandom(filename);
  }

  /** Delete the named file. Returns false if the scheme of filename cannot
View Full Code Here


  {
    filename = transform(filename);
    final FileSystem fs = getFileSystem(filename);
    if (fs == null)
      return false;
    if ((fs.capabilities() & FSCapability.WRITE) == 0)
      return false;
    try{
      return fs.delete(filename);
    } catch (IOException ioe) {
      return false;
View Full Code Here

  {
    path = transform(path);
        final FileSystem fs = getFileSystem(path);
        if (fs == null)
            return false;
    if ((fs.capabilities() & FSCapability.WRITE) == 0)
            return false;
    if ((fs.capabilities() & FSCapability.DEL_ON_EXIT) == 0)
      return false
    try{
            return fs.deleteOnExit(path);
View Full Code Here

        final FileSystem fs = getFileSystem(path);
        if (fs == null)
            return false;
    if ((fs.capabilities() & FSCapability.WRITE) == 0)
            return false;
    if ((fs.capabilities() & FSCapability.DEL_ON_EXIT) == 0)
      return false
    try{
            return fs.deleteOnExit(path);
        } catch (IOException ioe) {
            return false;
View Full Code Here

    path = transform(path);
    final FileSystem fs = getFileSystem(path);
    if (fs == null)
      return false;
    //System.err.printf("Cap: %d Stat: %d check: %d\n", fs.capabilities() , FSCapability.STAT, (fs.capabilities() & FSCapability.STAT));
    if ((fs.capabilities() & FSCapability.STAT) == 0)
      return true;
    try{
      return fs.exists(path);
    } catch (IOException ioe) {
      return false;
View Full Code Here

  {
    filename = transform(filename);
    final FileSystem fs = getFileSystem(filename);
    if (fs == null)
      return false;
    if ((fs.capabilities() & (FSCapability.READ | FSCapability.STAT)) == 0)
      return true;
    try{
      return fs.canRead(filename);
    } catch (IOException ioe) {
      return false;
View Full Code Here

  {
    filename = transform(filename);
    final FileSystem fs = getFileSystem(filename);
    if (fs == null)
      return false;
    if ((fs.capabilities() & (FSCapability.WRITE | FSCapability.STAT )) == 0)
      return false;
    try{
      return fs.canWrite(filename);
    } catch (IOException ioe) {
      return false;
View Full Code Here

  {
    path = transform(path);
    final FileSystem fs = getFileSystem(path);
    if (fs == null)
      return false;
    if ((fs.capabilities() & FSCapability.WRITE) == 0)
      return false;
    try{
      return fs.mkdir(path);
    } catch (IOException ioe) {
      return false;
View Full Code Here

  {
    filename = transform(filename);
    final FileSystem fs = getFileSystem(filename);
    if (fs == null)
      return 0L;
    if ((fs.capabilities() & FSCapability.STAT) == 0)
      return 0L;
    try{
      return fs.length(filename);
    } catch (IOException ioe) {
      return 0L;
View Full Code Here

  {
    path = transform(path);
        final FileSystem fs = getFileSystem(path);
        if (fs == null)
            return false;
        if ((fs.capabilities() & FSCapability.STAT) == 0)
            return false;
        try{
            return fs.isDirectory(path);
        } catch (IOException ioe) {
            return false;
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.