Package java.io
Class FileDescriptor
- java.lang.Object
-
- java.io.FileDescriptor
-
public final class FileDescriptor extends Object
Wraps a Unix file descriptor. It's possible to get the file descriptor used by some classes (such asFileInputStream,FileOutputStream, andRandomAccessFile), and then create new streams that point to the same file descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description static FileDescriptorerrCorresponds tostderr.static FileDescriptorinCorresponds tostdin.static FileDescriptoroutCorresponds tostdout.
-
Constructor Summary
Constructors Constructor Description FileDescriptor()Constructs a new invalid FileDescriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetInt$()Returns the int fd.booleanisSocket$()voidsetInt$(int fd)Sets the int fd.voidsync()Ensures that data which is buffered within the underlying implementation is written out to the appropriate device before returning.StringtoString()Returns a string containing a concise, human-readable description of this object.booleanvalid()Tests whether thisFileDescriptoris valid.
-
-
-
Field Detail
-
in
public static final FileDescriptor in
Corresponds tostdin.
-
out
public static final FileDescriptor out
Corresponds tostdout.
-
err
public static final FileDescriptor err
Corresponds tostderr.
-
-
Method Detail
-
sync
public void sync() throws SyncFailedExceptionEnsures that data which is buffered within the underlying implementation is written out to the appropriate device before returning.- Throws:
SyncFailedException
-
valid
public boolean valid()
Tests whether thisFileDescriptoris valid.
-
getInt$
public final int getInt$()
Returns the int fd. It's highly unlikely you should be calling this. Please discuss your needs with a libcore maintainer before using this method.
-
setInt$
public final void setInt$(int fd)
Sets the int fd. It's highly unlikely you should be calling this. Please discuss your needs with a libcore maintainer before using this method.
-
isSocket$
public final boolean isSocket$()
-
toString
public String toString()
Description copied from class:ObjectReturns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toStringmethod if you intend implementing your owntoStringmethod.
-
-