Example usage for org.apache.commons.vfs FileSystemException getLocalizedMessage

List of usage examples for org.apache.commons.vfs FileSystemException getLocalizedMessage

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileSystemException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:jfs.sync.vfs.JFSVFSFileProducer.java

/**
 * @return Returns the available schemes.
 *//*www  .j a va2 s.co  m*/
static public String[] getSchemes() {
    ArrayList<String> schemes = new ArrayList<String>();
    String[] schemesArray = new String[0];
    try {
        for (String s : VFS.getManager().getSchemes()) {
            if (!s.equals(JFSConst.SCHEME_LOCAL) && !s.equals(JFSConst.SCHEME_EXTERNAL)) {
                schemes.add(s);
            }
        }
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
    }
    return schemes.toArray(schemesArray);
}

From source file:jfs.sync.vfs.JFSVFSFileProducer.java

/**
 * Resets the file system manager.//from  w w  w .  j  a  v  a  2s  .co  m
 */
public void reset() {
    try {
        ((DefaultFileSystemManager) VFS.getManager()).close();
        ((DefaultFileSystemManager) VFS.getManager()).init();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * Creates a new external file for a certain path using a specific file
 * producer.//from  w  w w  . ja va 2s  .c  om
 * 
 * @param fileProducer
 *            The assigned file producer.
 * @param path
 *            The path to create the external file for.
 */
public JFSVFSFile(JFSVFSFileProducer fileProducer, String path) {
    super(fileProducer, path);
    try {
        file = VFS.getManager().resolveFile(fileProducer.getBaseFile(), path);
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#preCopyTgt(JFSFile)/*from w w  w .j  a v  a  2 s  . c o m*/
 */
protected boolean preCopyTgt(JFSFile srcFile) {
    try {
        file.getContent().close();
        return true;
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return false;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#canRead()/*  w  w w .  jav  a  2  s.  c  o  m*/
 */
public boolean canRead() {
    if (file == null) {
        return false;
    }
    try {
        return file.isReadable();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return false;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#canWrite()//  ww  w.  ja  v a  2  s . c  om
 */
public boolean canWrite() {
    if (file == null) {
        return false;
    }
    try {
        return file.isWriteable();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return false;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#getOutputStream()//from   w w w .  j  a v a  2s .c  o m
 */
protected OutputStream getOutputStream() {
    if (file == null) {
        return null;
    }
    try {
        return file.getContent().getOutputStream();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return null;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#delete()/* w  w  w. ja  va  2  s. c o  m*/
 */
public boolean delete() {
    if (file == null) {
        return false;
    }
    try {
        return file.delete();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return false;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#exists()/*from   w w  w.  ja v a 2 s  .c om*/
 */
public boolean exists() {
    if (file == null) {
        return false;
    }
    try {
        return file.exists();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return false;
    }
}

From source file:jfs.sync.vfs.JFSVFSFile.java

/**
 * @see JFSFile#getLastModified()/*from  ww w.  j  a  va  2 s  .  co  m*/
 */
public long getLastModified() {
    if (file == null || isDirectory()) {
        return 0;
    }
    try {
        return file.getContent().getLastModifiedTime();
    } catch (FileSystemException e) {
        JFSLog.getErr().getStream().println(e.getLocalizedMessage());
        return 0;
    }
}