com.plumtree.openfoundation.io
Class XPFile

java.lang.Object
  extended bycom.plumtree.openfoundation.io.XPFileSystemObject
      extended bycom.plumtree.openfoundation.io.XPFile

public class XPFile
extends XPFileSystemObject

XPFile is an abstract representation of a file pathname.


Constructor Summary
XPFile(java.lang.String fileName)
          Creates a new File Object (not the file system file) by converting the given pathname string into an abstract pathname.
 
Method Summary
 XPFileWriter CreateText()
          Create an XPFileWriter that writes a new text file.
 void Delete()
          Delete this file.
 boolean Exists()
          Returns true if this file exists, false if it does not.
 long GetFileSize()
          Returns the length of this file.
 java.lang.String GetFullPath()
          Returns the full path for this file (e.g.
 XPDateTime GetLastModifiedTime()
          Returns the last modified time of this file.
 java.lang.String GetName()
          Returns the name of this file (e.g.
 XPDirectory GetParent()
          Returns an XPDirectory representing the file this object is in.
 java.io.File GetUnderlyingObject()
          Returns the platform specific object.
 boolean IsDirectory()
          Returns a boolean value that determines if this object is a directory or not.
 boolean IsHidden()
          Returns a boolean value that determines if this file is hidden.
 boolean IsReadOnly()
          Returns a boolean value that determines if this file is read only or not.
 void MoveTo(XPFile toFile)
          Moves a file.
 XPFileReader OpenText()
          Returns a file reader used to read the contents of this file.
 boolean SetReadOnly()
          Returns a boolean value that determines if the Readonly property is set or not.
 
Methods inherited from class com.plumtree.openfoundation.io.XPFileSystemObject
GetExistingPath, GetPathSeparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPFile

public XPFile(java.lang.String fileName)
Creates a new File Object (not the file system file) by converting the given pathname string into an abstract pathname.

Parameters:
fileName - pathname of the file
Method Detail

CreateText

public XPFileWriter CreateText()
Create an XPFileWriter that writes a new text file.

Returns:
An instance of an XPFileWriter used to write into the file

Delete

public void Delete()
Delete this file.

Specified by:
Delete in class XPFileSystemObject

Exists

public boolean Exists()
Returns true if this file exists, false if it does not.

Specified by:
Exists in class XPFileSystemObject
Returns:
true if this file exists; false otherwise

GetFileSize

public long GetFileSize()
Returns the length of this file.

Returns:
the length of this file.

GetFullPath

public java.lang.String GetFullPath()
Returns the full path for this file (e.g. "c:\somedir\somedir2\file.txt")

Specified by:
GetFullPath in class XPFileSystemObject
Returns:
full path of this file

GetName

public java.lang.String GetName()
Returns the name of this file (e.g. "file.txt")

Specified by:
GetName in class XPFileSystemObject
Returns:
name of this file

GetParent

public XPDirectory GetParent()
Returns an XPDirectory representing the file this object is in.

Specified by:
GetParent in class XPFileSystemObject
Returns:
An instance of XPDirectory that this file resides in

GetUnderlyingObject

public java.io.File GetUnderlyingObject()
Returns the platform specific object.

Returns:
An instance of File class

IsDirectory

public boolean IsDirectory()
Returns a boolean value that determines if this object is a directory or not.

Specified by:
IsDirectory in class XPFileSystemObject
Returns:
true if the file path represented by the XPFile exists and is a directory; false otherwise

OpenText

public XPFileReader OpenText()
Returns a file reader used to read the contents of this file.

Returns:
An instance of a FileReader used to read the contents of this file

GetLastModifiedTime

public XPDateTime GetLastModifiedTime()
Returns the last modified time of this file.

Specified by:
GetLastModifiedTime in class XPFileSystemObject
Returns:
An instance of XPDateTime that represents the last modified time of this file.

SetReadOnly

public boolean SetReadOnly()
Returns a boolean value that determines if the Readonly property is set or not.

Specified by:
SetReadOnly in class XPFileSystemObject
Returns:
true if the Readonly property is set; false otherwise

IsReadOnly

public boolean IsReadOnly()
Returns a boolean value that determines if this file is read only or not.

Specified by:
IsReadOnly in class XPFileSystemObject
Returns:
true if this file exists and is read only

IsHidden

public boolean IsHidden()
Returns a boolean value that determines if this file is hidden.

Specified by:
IsHidden in class XPFileSystemObject
Returns:
true if the file is hidden; false otherwise

MoveTo

public void MoveTo(XPFile toFile)
Moves a file. This can also be used to rename a file. This XPFile instance will represent to target file once moved.

Parameters:
toFile - the file to move the current file to


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.