java::io::FileDescriptor Class Reference

Inheritance diagram for java::io::FileDescriptor:

Inheritance graph
java::lang::Object
[legend]
Collaboration diagram for java::io::FileDescriptor:

Collaboration graph
java::lang::Object
[legend]

List of all members.


Detailed Description

Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure representing an open file, an open socket, or another source or sink of bytes.

The main practical use for a file descriptor is to create a FileInputStream or FileOutputStream to contain it.

Applications should not create their own file descriptors.

Author:
Pavani Diwanji
Version:
1.19, 12/03/01
Since:
JDK1.0

Public Member Functions

 FileDescriptor (jvoid _fd=(jvoid)-1)
 Constructs an (invalid) FileDescriptor object.
FileDescriptoroperator= (jvoid _fd)
 operator jvoid & ()
jboolean valid () const
 Tests if this file descriptor object is valid.
void sync ()
 Force all system buffers to synchronize with the underlying device.
jboolean equals (const FileDescriptor &fd) const
 Tests this abstract pathname for equality with the given object.
jboolean equals (const Object &obj) const
 Tests this abstract pathname for equality with the given object.
jint hashCode () const
 Computes a hash code for this abstract pathname.

Static Public Attributes

static FileDescriptor in
 A handle to the standard input stream.
static FileDescriptor out
 A handle to the standard output stream.
static FileDescriptor err
 A handle to the standard error stream.

Constructor & Destructor Documentation

java::io::FileDescriptor::FileDescriptor ( jvoid  _fd = (jvoid)-1  ) 

Constructs an (invalid) FileDescriptor object.


Member Function Documentation

FileDescriptor& java::io::FileDescriptor::operator= ( jvoid  _fd  ) 

java::io::FileDescriptor::operator jvoid & (  ) 

jboolean java::io::FileDescriptor::valid (  )  const

Tests if this file descriptor object is valid.

Returns:
true if the file descriptor object represents a valid, open file, socket, or other active I/O connection; false otherwise.

void java::io::FileDescriptor::sync (  ) 

Force all system buffers to synchronize with the underlying device.

This method returns after all modified data and attributes of this FileDescriptor have been written to the relevant device(s). In particular, if this FileDescriptor refers to a physical storage medium, such as a file in a file system, sync will not return until all in-memory modified copies of buffers associated with this FileDesecriptor have been written to the physical medium.

sync is meant to be used by code that requires physical storage (such as a file) to be in a known state For example, a class that provided a simple transaction facility might use sync to ensure that all changes to a file caused by a given transaction were recorded on a storage medium.

sync only affects buffers downstream of this FileDescriptor. If any in-memory buffering is being done by the application (for example, by a BufferedOutputStream object), those buffers must be flushed into the FileDescriptor (for example, by invoking OutputStream.flush) before that data will be affected by sync.

Exceptions:
SyncFailedException Thrown when the buffers cannot be flushed, or because the system cannot guarantee that all the buffers have been synchronized with physical media.
Since:
JDK1.1

jboolean java::io::FileDescriptor::equals ( const FileDescriptor fd  )  const

Tests this abstract pathname for equality with the given object.

Returns true if and only if the argument is not null and is an abstract pathname that denotes the same file or directory as this abstract pathname. Whether or not two abstract pathnames are equal depends upon the underlying system. On UNIX systems, alphabetic case is significant in comparing pathnames; on Win32 systems it is not.

Parameters:
obj The object to be compared with this abstract pathname
Returns:
true if and only if the objects are the same; false otherwise

jboolean java::io::FileDescriptor::equals ( const Object obj  )  const [virtual]

Tests this abstract pathname for equality with the given object.

Returns true if and only if the argument is not null and is an abstract pathname that denotes the same file or directory as this abstract pathname. Whether or not two abstract pathnames are equal depends upon the underlying system. On UNIX systems, alphabetic case is significant in comparing pathnames; on Win32 systems it is not.

Parameters:
obj The object to be compared with this abstract pathname
Returns:
true if and only if the objects are the same; false otherwise

Reimplemented from java::lang::Object.

jint java::io::FileDescriptor::hashCode (  )  const [virtual]

Computes a hash code for this abstract pathname.

Because equality of abstract pathnames is inherently system-dependent, so is the computation of their hash codes. On UNIX systems, the hash code of an abstract pathname is equal to the exclusive or of its pathname string and the decimal value 1234321. On Win32 systems, the hash code is equal to the exclusive or of its pathname string, convered to lower case, and the decimal value 1234321.

Returns:
A hash code for this abstract pathname

Reimplemented from java::lang::Object.


Member Data Documentation

FileDescriptor java::io::FileDescriptor::in [static]

A handle to the standard input stream.

Usually, this file descriptor is not used directly, but rather via the input stream known as System.in.

FileDescriptor java::io::FileDescriptor::out [static]

A handle to the standard output stream.

Usually, this file descriptor is not used directly, but rather via the output stream known as System.out.

FileDescriptor java::io::FileDescriptor::err [static]

A handle to the standard error stream.

Usually, this file descriptor is not used directly, but rather via the output stream known as System.err.

See also:
java.lang.System::err


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:30 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3