com.partnersoft.io.vfs
Class VfsLib

java.lang.Object
  extended by com.partnersoft.io.vfs.VfsLib
All Implemented Interfaces:
Lib

public class VfsLib
extends java.lang.Object
implements Lib

Various handy tools for manipulating VFSen.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
VfsLib()
           
 
Method Summary
static VfsFile joinFiles(VfsFile outputFile, java.lang.Iterable<VfsFile> parts)
          Joins the given files together into the given output file.
static VfsFile joinFiles(VfsFile outputFile, java.util.Iterator<VfsFile> parts)
          Joins the given files together into the given output file.
static VfsFile joinFiles(VfsFile outputFile, VfsFile... parts)
          Joins the given files together into the given output file.
static java.util.List<VfsFile> splitFile(VfsFile source, ByteSize maximumSize, VfsDirectory destination)
          Splits the given VfsFile into several subfiles in the given destination directory, each with the extension .001, .002, etc.
static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file, ByteSize byteSize)
          Splits the given VfsFile into several subfiles in the same directory, each with the extension .001, .002, etc.
static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file, int megabytes)
          Splits the given VfsFile into several subfiles in the same directory, each with the extension .001, .002, etc.
static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file, int megabytes, VfsDirectory destination)
          Splits the given VfsFile into several subfiles in the given destination directory, each with the extension .001, .002, etc.
static VfsDirectory vfsDirectoryFor(java.io.File file)
          Creates a VfsDirectory for the given directory, using its discretion as to how to obtain the VFS...
static VfsDirectory vfsDirectoryFor(java.lang.String directoryPath)
          Creates a VfsDirectory for the given path, using its discretion as to how to obtain the VFS...
static VfsFile vfsFileFor(java.io.File file)
          Creates a VfsFile for the given file, using its discretion as to how to obtain the VFS...
static VfsFile vfsFileFor(java.lang.String filePath)
          Creates a VfsFile for the given file path, using its discretion as to how to obtain the VFS...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VfsLib

public VfsLib()
Method Detail

vfsFileFor

public static VfsFile vfsFileFor(java.io.File file)
                          throws java.io.IOException
Creates a VfsFile for the given file, using its discretion as to how to obtain the VFS... generally it will create a fresh FileVfs based on the File's parent directory. Therefore, use this method sparingly; it is far better practice to use the SystemServices.vfs() for files inside the installation, or to create your own VFS and re-use it for all your file needs outside the installation.

Throws:
java.io.IOException

vfsFileFor

public static VfsFile vfsFileFor(java.lang.String filePath)
                          throws java.io.IOException
Creates a VfsFile for the given file path, using its discretion as to how to obtain the VFS... generally it will create a fresh FileVfs based on the File's parent directory. Therefore, use this method sparingly; it is far better practice to use the SystemServices.vfs() for files inside the installation, or to create your own VFS and re-use it for all your file needs outside the installation.

Throws:
java.io.IOException

vfsDirectoryFor

public static VfsDirectory vfsDirectoryFor(java.io.File file)
                                    throws java.io.IOException
Creates a VfsDirectory for the given directory, using its discretion as to how to obtain the VFS... generally it will create a fresh FileVfs rooted at the directory. Therefore, use this method sparingly; it is far better practice to use the SystemServices.vfs() for files inside the installation, or to create your own VFS and re-use it for all your file needs outside the installation.

Throws:
java.io.IOException

vfsDirectoryFor

public static VfsDirectory vfsDirectoryFor(java.lang.String directoryPath)
                                    throws java.io.IOException
Creates a VfsDirectory for the given path, using its discretion as to how to obtain the VFS... generally it will create a fresh FileVfs rooted at the directory. Therefore, use this method sparingly; it is far better practice to use the SystemServices.vfs() for files inside the installation, or to create your own VFS and re-use it for all your file needs outside the installation.

Throws:
java.io.IOException

splitFile

public static java.util.List<VfsFile> splitFile(VfsFile source,
                                                ByteSize maximumSize,
                                                VfsDirectory destination)
                                         throws java.io.IOException
Splits the given VfsFile into several subfiles in the given destination directory, each with the extension .001, .002, etc. based on the given maximum ByteSize.

Throws:
java.io.IOException

splitFileByMegabytes

public static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file,
                                                           int megabytes,
                                                           VfsDirectory destination)
                                                    throws java.io.IOException
Splits the given VfsFile into several subfiles in the given destination directory, each with the extension .001, .002, etc. based on the given maximum bytesize in megabytes.

Throws:
java.io.IOException

splitFileByMegabytes

public static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file,
                                                           int megabytes)
                                                    throws java.io.IOException
Splits the given VfsFile into several subfiles in the same directory, each with the extension .001, .002, etc. based on the given maximum bytesize in megabytes.

Throws:
java.io.IOException

splitFileByMegabytes

public static java.util.List<VfsFile> splitFileByMegabytes(VfsFile file,
                                                           ByteSize byteSize)
                                                    throws java.io.IOException
Splits the given VfsFile into several subfiles in the same directory, each with the extension .001, .002, etc. based on the given maximum maximum ByteSize.

Throws:
java.io.IOException

joinFiles

public static VfsFile joinFiles(VfsFile outputFile,
                                VfsFile... parts)
                         throws java.io.IOException
Joins the given files together into the given output file. Returns the output file for convenience.

Throws:
java.io.IOException

joinFiles

public static VfsFile joinFiles(VfsFile outputFile,
                                java.util.Iterator<VfsFile> parts)
                         throws java.io.IOException
Joins the given files together into the given output file. Returns the output file for convenience.

Throws:
java.io.IOException

joinFiles

public static VfsFile joinFiles(VfsFile outputFile,
                                java.lang.Iterable<VfsFile> parts)
                         throws java.io.IOException
Joins the given files together into the given output file. Returns the output file for convenience.

Throws:
java.io.IOException