Package org.apache.commons.vfs.provider.local

Examples of org.apache.commons.vfs.provider.local.LocalFile


      sb.append(System.getProperty("user.home"));
      sb.append("/.docx4j/tmp/");
      sb.append(fo.getName().getBaseName());
      String tmpPath = sb.toString().replace('\\', '/');
     
      LocalFile localCopy = null;
      try {
        localCopy = (LocalFile) VFS.getManager().resolveFile(tmpPath);
        localCopy.copyFrom(fo, new FileTypeSelector(FileType.FILE));
        localCopy.close();
       
        thePackage = getPackageFromLocalFile(localCopy);
      } catch (FileSystemException exc) {
        exc.printStackTrace();
        throw new Docx4JException("Could not create a temporary local copy", exc);
      } finally {
        if (localCopy != null) {
          try {
            localCopy.delete();
          } catch (FileSystemException exc) {
            exc.printStackTrace();
            log.warn("Couldn't delete temporary file " + tmpPath);
          }
        }
View Full Code Here


   * @throws Exception
   */
  public static WordprocessingMLPackage convert(
      org.apache.commons.vfs.FileObject in) throws Exception {

    LocalFile localCopy = null;
    if (!(in instanceof LocalFile)) {

      StringBuffer sb = new StringBuffer("file:///");
      sb.append(System.getProperty("user.home"));
      sb.append("/.docx4j/tmp/");
      sb.append(in.getName().getBaseName());
      String tmpPath = sb.toString().replace('\\', '/');

      try {
        localCopy = (LocalFile) VFS.getManager().resolveFile(tmpPath);
        localCopy.copyFrom(in, new FileTypeSelector(FileType.FILE));
        localCopy.close();
      } catch (FileSystemException exc) {
        exc.printStackTrace();
        throw new Docx4JException(
            "Could not create a temporary local copy", exc);
      } finally {
        if (localCopy != null) {
          try {
            localCopy.delete();
          } catch (FileSystemException exc) {
            exc.printStackTrace();
            log.warn("Couldn't delete temporary file " + tmpPath);
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs.provider.local.LocalFile

Copyright © 2018 www.massapicom. 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.