|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface that defines a T3File. T3Files are produced by WebLogic File Systems, and as such may represent local files on the client or remote files on the server. This makes it easy to write code that treats the two uniformly.
In addition to methods that mirror those of java.io.File, T3File has methods to produce T3FileInputStreams and T3FileOutputStreams. All of these methods behave the same for local and remote files except for the following. First, there is no notion of the "current user directory" on a remote file system, so all file names are absolute. Second, the bufferSize, readAhead, and writeBehind arguments to the methods for producing streams are ignored in the local case.
Here's an example of how this interface is used in the process of deleting a remote file:
T3Client t3 = new T3Client("t3://host:port"); // Get file system and file. T3FileSystem myfs = t3.services.io().getFileSystem("myFileSystem"); T3File myFile = myfs.getFile("someDirectory/someFile"); // Use java.io.File-style methods to delete the file myFile.delete();
T3FileSystem
,
T3FileInputStream
,
T3FileOutputStream
Method Summary | |
boolean |
canRead()
Tests if the application can read from the specified file. |
boolean |
canWrite()
Tests if the application can write to this file. |
boolean |
delete()
Deletes the file specified by this object. |
boolean |
equals(java.lang.Object obj)
Compares this object against the specified object. |
boolean |
exists()
Tests if this T3File exists. |
T3File |
extend(java.lang.String suffix)
Returns a new T3File defined by this file's path extended by a suffix. |
java.lang.String |
getAbsolutePath()
Returns the absolute pathname of the file represented by this object. |
java.lang.String |
getCanonicalPath()
Returns the canonical form of this T3File object's pathname. |
T3FileInputStream |
getFileInputStream()
Gets a new T3FileInputStream object for reading from the file. |
T3FileInputStream |
getFileInputStream(int bufferSize,
int readAhead)
Gets a new T3FileInputStream object for reading from the file. |
T3FileOutputStream |
getFileOutputStream()
Gets a new T3FileOutputStream object for writing to the file. |
T3FileOutputStream |
getFileOutputStream(int bufferSize,
int writeBehind)
Gets a new T3FileOutputStream object for writing to the file. |
java.lang.String |
getName()
Returns the name of the file represented by this object. |
java.lang.String |
getParent()
Returns the parent part of the pathname of this T3File
object, or null if the name has no parent part. |
java.lang.String |
getPath()
Returns the pathname of the file represented by this object. |
int |
hashCode()
Computes a hashcode for the file. |
boolean |
isAbsolute()
Tests if the file represented by this T3File object is an
absolute pathname. |
boolean |
isDirectory()
Tests if the file represented by this T3File
object is a directory. |
boolean |
isFile()
Tests if the file represented by this T3File
object is a "normal" file. |
long |
lastModified()
Returns the time that the file represented by this T3File object was last modified. |
long |
length()
Returns the length of the file represented by this T3File object. |
java.lang.String[] |
list()
Returns a list of the files in the directory specified by this T3File object. |
java.lang.String[] |
list(java.io.FilenameFilter filter)
Returns a list of the files in the directory specified by this T3File that satisfy the specified filter. |
boolean |
mkdir()
Creates a directory whose pathname is specified by this T3File object. |
boolean |
mkdirs()
Creates a directory whose pathname is specified by this T3File object, including any necessary parent directories. |
boolean |
renameTo(T3File dest)
Renames the file specified by this T3File object to
have the pathname given by the T3File argument. |
java.lang.String |
toString()
Returns a string representation of this object. |
Method Detail |
public T3FileInputStream getFileInputStream() throws T3Exception
public T3FileInputStream getFileInputStream(int bufferSize, int readAhead) throws T3Exception
bufferSize
- Size of transfer buffers in bytesreadAhead
- Number of transfer buffers fetched in advancepublic T3FileOutputStream getFileOutputStream() throws T3Exception
public T3FileOutputStream getFileOutputStream(int bufferSize, int writeBehind) throws T3Exception
bufferSize
- Size of transfer buffers in byteswriteBehind
- Number of unwritten transfer bufferspublic T3File extend(java.lang.String suffix)
suffix
- the path suffixpublic java.lang.String getName()
T3File
objectgetPath()
public java.lang.String getPath()
T3File
objectpublic java.lang.String getAbsolutePath()
The system property user.dir
contains the current
user directory.
T3File
getPath()
,
isAbsolute()
public java.lang.String getCanonicalPath() throws java.io.IOException
T3File
object's pathname.
The precise definition of canonical form is system-dependent, but it
usually specifies an absolute pathname in which all relative references
and references to the current user directory have been completely
resolved. The canonical form of a pathname of a nonexistent file may
not be defined.
public java.lang.String getParent()
T3File
object, or null
if the name has no parent part. The parent
part is generally everything leading up to the last occurrence of the
separator character, although the precise definition is system
dependent. On UNIX, for example, the parent part of
/usr/lib
is /usr
, whose parent part is
/
, which in turn has no parent. On Windows platforms,
the parent part of c:\java
is c:\
, which
in turn has no parent.
getPath()
,
getCanonicalPath()
public boolean exists() throws java.lang.SecurityException
T3File
exists.
true
if the file specified by this object
exists; false
otherwisecheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public boolean canWrite() throws java.lang.SecurityException
true
if the application is allowed to write to
the file specified by this object;
false
otherwisecheckWrite
method is called with the pathname
of this T3File
to see if the application is
allowed write access to the filegetPath()
,
SecurityManager.checkWrite(java.lang.String)
public boolean canRead() throws java.lang.SecurityException
true
if the file specified by this object exists
and the application can read the file;
false
otherwisecheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public boolean isFile() throws java.lang.SecurityException
T3File
object is a "normal" file.
A file is "normal" if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.
true
if the file specified by this object
exists and is a "normal" file; false
otherwisecheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public boolean isDirectory() throws java.lang.SecurityException
T3File
object is a directory.
true
if this T3File
exists and is a
directory; false
otherwisecheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public boolean isAbsolute()
T3File
object is an
absolute pathname. The definition of an absolute pathname is system
dependent. For example, on UNIX, a pathname is absolute if its
first character is the separator character. On Windows platforms,
a pathname is absolute if its first character is an ASCII '\' or
'/', or if it begins with a letter followed by a colon. Remote file
systems do not have a current user directory, so remote file names
are always absolute.
true
if the pathname indicated by the
T3File
object is an absolute pathname;
false
otherwisegetPath()
public long lastModified() throws java.lang.SecurityException
T3File
object was last modified.
The return value is system dependent and should only be used to compare with other values returned by last modified. It should not be interpreted as an absolute time.
0L
if the specified file does not existcheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public long length() throws java.lang.SecurityException
T3File
object.
0L
if the specified file does not existcheckRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public boolean mkdir() throws java.lang.SecurityException
T3File
object.
true
if the directory could be created;
false
otherwisecheckWrite
method is called with the pathname
of this T3File
to see if the application is
allowed write access to the filegetPath()
,
SecurityManager.checkWrite(java.lang.String)
public boolean renameTo(T3File dest) throws java.lang.SecurityException
T3File
object to
have the pathname given by the T3File
argument. The
renaming fails if the two files are not on the same file system.
dest
- the new filenametrue
if the renaming succeeds;
false
otherwisecheckWrite
method is called both with the
pathname of this file object and with the pathname of the
destination target object to see if the application is
allowed to write to both filesgetPath()
,
SecurityManager.checkWrite(java.lang.String)
public boolean mkdirs() throws java.lang.SecurityException
T3File
object, including any necessary parent directories.
true
if the directory (or directories) could be
created; false
otherwisecheckWrite
method is called with the pathname
of each of the directories that is to be created, before
any of the directories are createdgetPath()
,
SecurityManager.checkWrite(java.lang.String)
public java.lang.String[] list() throws java.lang.SecurityException
T3File
object.
.
" and "..
"
on Unix systems)checkRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
SecurityManager.checkRead(java.lang.String)
public java.lang.String[] list(java.io.FilenameFilter filter) throws java.lang.SecurityException
T3File
that satisfy the specified filter. If the file
system is remote, the filename filter must be serializable.
filter
- a filename filter.
" and "..
"
on Unix systems)checkRead
method is called with the pathname
of this T3File
to see if the application is
allowed read access to the filegetPath()
,
FilenameFilter
,
SecurityManager.checkRead(java.lang.String)
public boolean delete() throws java.lang.SecurityException
true
if the file is successfully deleted;
false
otherwisecheckDelete
method is called with the
pathname of this T3File
to see if the
application is allowed to delete the filegetPath()
,
SecurityManager.checkDelete(java.lang.String)
public int hashCode()
T3File
objectpublic boolean equals(java.lang.Object obj)
true
if and only if the argument:
null
T3File
object;
obj
- the object to compare withtrue
if the objects are the same;
false
otherwisepublic java.lang.String toString()
getPath()
|
Documentation is available at http://e-docs.bea.com/wls/docs61 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |