NOS.io
Class NOSFile

java.lang.Object
  extended by NOS.io.NOSFile

public class NOSFile
extends java.lang.Object


Constructor Summary
NOSFile(java.lang.String path)
          Creates a new NOSFile object.
 
Method Summary
 boolean copyInto(NOSFile target)
          Makes a copy of this file
 boolean delete()
          Removes this file and all sub-files from the server.
 boolean exists()
          Returns true if this file exists on the server.
 java.lang.String getExtension()
          Returns the extension of this file (eg: .bmp .jpg .gif .txt .html)
 javax.swing.Icon getIcon()
          Returns a 25x25 pixel icon for this file.
 java.io.InputStream getInputStream()
          Returns an InputStream for reading from this file.
 java.io.InputStream getInputStream(NOSTransferProgressListener list)
          Returns an InputStream for reading from this file.
 java.lang.String getName()
          Returns the name of this file
 java.io.OutputStream getOutputStream()
          Returns an OutputStream for writing to this file.
 java.io.OutputStream getOutputStream(NOSTransferProgressListener list)
          Returns an OutputStream for writing to this file.
 java.lang.String getParent()
          Returns the path of the parent of this file
 NOSFile getParentFile()
          Returns the parent file of this file
 java.lang.String getPath()
          Returns the path to this file
 java.lang.String getRemotePath()
          Returns the path to this file as it would appear in a URL.
 boolean isDirectory()
          Returns true if this file is a directory
 long length()
          Returns the length of this file in bytes.
 NOSFile[] listFiles()
          Returns a list of the files contained within this file (if it is a directory).
 NOSFile[] listFiles(boolean forcerefresh)
          Returns a list of the files contained within this file (if it is a directory).
 NOSFile makeCopy()
          Makes a copy of this NOSFile object (not the file itself).
 boolean mkdirs()
          Creates directories for all the parent directories of this file and a directory with the name of this file (just like the finction in the normal File object).
 boolean rename(java.lang.String newpath)
          Renames this file
 java.lang.String toString()
          Returns a String representation of this NOSFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NOSFile

public NOSFile(java.lang.String path)
Creates a new NOSFile object.

Parameters:
path - The path to the file
Method Detail

getPath

public java.lang.String getPath()
Returns the path to this file

Returns:
the path to this file

getRemotePath

public java.lang.String getRemotePath()
Returns the path to this file as it would appear in a URL.

Returns:
the path to this file as it would appear in a URL.

getParentFile

public NOSFile getParentFile()
Returns the parent file of this file

Returns:
the parent file of this file

getParent

public java.lang.String getParent()
Returns the path of the parent of this file

Returns:
the path of the parent of this file

getName

public java.lang.String getName()
Returns the name of this file

Returns:
the name of this file!

getExtension

public java.lang.String getExtension()
Returns the extension of this file (eg: .bmp .jpg .gif .txt .html)

Returns:
the extension of this file

getIcon

public javax.swing.Icon getIcon()
Returns a 25x25 pixel icon for this file.

Returns:
A 25x25 pixel icon for this file.

listFiles

public NOSFile[] listFiles()
Returns a list of the files contained within this file (if it is a directory).

Returns:
a list of the files contained within this file (if it is a directory).

listFiles

public NOSFile[] listFiles(boolean forcerefresh)
Returns a list of the files contained within this file (if it is a directory).

Parameters:
forcerefresh - If true the the server will be interrogated for a new list of files.
Returns:
a list of the files contained within this file (if it is a directory).

length

public long length()
Returns the length of this file in bytes.

Returns:
the length of this file in bytes.

mkdirs

public boolean mkdirs()
Creates directories for all the parent directories of this file and a directory with the name of this file (just like the finction in the normal File object).

Returns:
True on sucess.

delete

public boolean delete()
Removes this file and all sub-files from the server.

Returns:
True on sucess.

rename

public boolean rename(java.lang.String newpath)
Renames this file

Parameters:
newpath - The new name
Returns:
True on sucess.

copyInto

public boolean copyInto(NOSFile target)
Makes a copy of this file

Parameters:
target - The file into which to copy this file.
Returns:
True on sucess.

isDirectory

public boolean isDirectory()
Returns true if this file is a directory

Returns:
True if directory.

exists

public boolean exists()
Returns true if this file exists on the server.

Returns:
true if this file exists on the server.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream for reading from this file.

Returns:
an InputStream for reading from this file.
Throws:
java.io.IOException - If an error occurs

getInputStream

public java.io.InputStream getInputStream(NOSTransferProgressListener list)
                                   throws java.io.IOException
Returns an InputStream for reading from this file.

Parameters:
list - A NOSTransferProgressListener
Returns:
an InputStream for reading from this file.
Throws:
java.io.IOException - If an error occurs

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns an OutputStream for writing to this file.

Returns:
an OutputStream for writing to this file.
Throws:
java.io.IOException - If an error occurs

getOutputStream

public java.io.OutputStream getOutputStream(NOSTransferProgressListener list)
                                     throws java.io.IOException
Returns an OutputStream for writing to this file.

Parameters:
list - A NOSTransferProgressListener
Returns:
an OutputStream for writing to this file.
Throws:
java.io.IOException - If an error occurs

makeCopy

public NOSFile makeCopy()
Makes a copy of this NOSFile object (not the file itself).

Returns:
A copy of this NOSFile object.

toString

public java.lang.String toString()
Returns a String representation of this NOSFile

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this NOSFile