com.android.io
Class FileWrapper

java.lang.Object
  extended by java.io.File
      extended by com.android.io.FileWrapper
All Implemented Interfaces:
IAbstractFile, IAbstractResource, java.io.Serializable, java.lang.Comparable<java.io.File>

public class FileWrapper
extends java.io.File
implements IAbstractFile

An implementation of IAbstractFile extending File.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.android.io.IAbstractFile
IAbstractFile.PreferredWriteMode
 
Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
FileWrapper(java.io.File file)
          Creates a new File instance matching a given File object.
FileWrapper(java.io.File parent, java.lang.String child)
          Creates a new File instance from a parent abstract pathname and a child pathname string.
FileWrapper(java.lang.String osPathname)
          Creates a new File instance by converting the given pathname string into an abstract pathname.
FileWrapper(java.lang.String parent, java.lang.String child)
          Creates a new File instance from a parent abstract pathname and a child pathname string.
FileWrapper(java.net.URI uri)
          Creates a new File instance by converting the given file: URI into an abstract pathname.
 
Method Summary
 boolean exists()
          Returns whether the resource actually exists.
 java.io.InputStream getContents()
          Returns an InputStream object on the file content.
 long getModificationStamp()
          Returns the last modification timestamp
 java.lang.String getOsLocation()
          Returns the OS path of the folder location.
 java.io.OutputStream getOutputStream()
          Returns an OutputStream to write into the file.
 IAbstractFolder getParentFolder()
          Returns the parent folder or null if there is no parent.
 IAbstractFile.PreferredWriteMode getPreferredWriteMode()
          Returns the preferred mode to write into the file.
 void setContents(java.io.InputStream source)
          Sets the content of the file.
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.io.IAbstractResource
delete, getName
 

Constructor Detail

FileWrapper

public FileWrapper(java.io.File file)
Creates a new File instance matching a given File object.

Parameters:
file - the file to match

FileWrapper

public FileWrapper(java.io.File parent,
                   java.lang.String child)
Creates a new File instance from a parent abstract pathname and a child pathname string.

Parameters:
parent - the parent pathname
child - the child name
See Also:
File.File(File, String)

FileWrapper

public FileWrapper(java.lang.String osPathname)
Creates a new File instance by converting the given pathname string into an abstract pathname.

Parameters:
osPathname - the OS pathname
See Also:
File.File(String)

FileWrapper

public FileWrapper(java.lang.String parent,
                   java.lang.String child)
Creates a new File instance from a parent abstract pathname and a child pathname string.

Parameters:
parent - the parent pathname
child - the child name
See Also:
File.File(String, String)

FileWrapper

public FileWrapper(java.net.URI uri)
Creates a new File instance by converting the given file: URI into an abstract pathname.

Parameters:
uri - An absolute, hierarchical URI with a scheme equal to "file", a non-empty path component, and undefined authority, query, and fragment components
See Also:
File.File(URI)
Method Detail

getContents

public java.io.InputStream getContents()
                                throws StreamException
Description copied from interface: IAbstractFile
Returns an InputStream object on the file content. The stream must be closed by the caller.

Specified by:
getContents in interface IAbstractFile
Throws:
StreamException

setContents

public void setContents(java.io.InputStream source)
                 throws StreamException
Description copied from interface: IAbstractFile
Sets the content of the file.

Specified by:
setContents in interface IAbstractFile
Parameters:
source - the content
Throws:
StreamException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws StreamException
Description copied from interface: IAbstractFile
Returns an OutputStream to write into the file.

Specified by:
getOutputStream in interface IAbstractFile
Throws:
StreamException

getPreferredWriteMode

public IAbstractFile.PreferredWriteMode getPreferredWriteMode()
Description copied from interface: IAbstractFile
Returns the preferred mode to write into the file.

Specified by:
getPreferredWriteMode in interface IAbstractFile

getOsLocation

public java.lang.String getOsLocation()
Description copied from interface: IAbstractResource
Returns the OS path of the folder location.

Specified by:
getOsLocation in interface IAbstractResource

exists

public boolean exists()
Description copied from interface: IAbstractResource
Returns whether the resource actually exists.

Specified by:
exists in interface IAbstractResource
Overrides:
exists in class java.io.File

getModificationStamp

public long getModificationStamp()
Description copied from interface: IAbstractFile
Returns the last modification timestamp

Specified by:
getModificationStamp in interface IAbstractFile

getParentFolder

public IAbstractFolder getParentFolder()
Description copied from interface: IAbstractResource
Returns the parent folder or null if there is no parent.

Specified by:
getParentFolder in interface IAbstractResource