Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > FileDescriptor

Reply
Thread Tools

FileDescriptor

 
 
bob smith
Guest
Posts: n/a
 
      10-12-2012
Can someone help me understand the class FileDescriptor?

Seems like it is mainly a wrapper for this:

private int fd;

But there's no obvious way to access or set that value. Am I missing something?
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      10-12-2012
On 10/12/12 3:23 PM, bob smith wrote:
> Can someone help me understand the class FileDescriptor?
>
> Seems like it is mainly a wrapper for this:
>
> private int fd;
>
> But there's no obvious way to access or set that value. Am I missing something?
>

What would you do with that value? It is generally opaque, and only
useful to pass through to other methods which already take the
FileDescriptor object.
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      10-13-2012
On 10/12/2012 6:23 PM, bob smith wrote:
> Can someone help me understand the class FileDescriptor?
>
> Seems like it is mainly a wrapper for this:
>
> private int fd;
>
> But there's no obvious way to access or set that value. Am I missing something?


To quote the docs:

<docs>
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.
</docs>

You can get it out from a File*Stream and you can use it to
construct a new File*Stream.

But what it contains is implementation specific and hidden
from you.

Good OOP.

On various *nix and *nix-like OS'es it could be a traditional
int fd.

Arne



 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      10-13-2012
On Fri, 12 Oct 2012 15:23:37 -0700 (PDT), bob smith
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone
who said :

>Can someone help me understand the class FileDescriptor?


It is not a class you would use directly. It provides a way to hold a
platform-specific handle to an open file.

At the assembler level in Windows, when you open a file, Windows gives
you an int handle to use to read/write. You don't specify the full
filename each time or read or write, just the handle.
--
Roedy Green Canadian Mind Products http://mindprod.com
The iPhone 5 is a low end Rolex.


 
Reply With Quote
 
Arne Vajhoej
Guest
Posts: n/a
 
      10-13-2012
On 10/13/2012 4:58 PM, Roedy Green wrote:
> On Fri, 12 Oct 2012 15:23:37 -0700 (PDT), bob smith
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone
> who said :
>> Can someone help me understand the class FileDescriptor?

>
> It is not a class you would use directly. It provides a way to hold a
> platform-specific handle to an open file.


So far so good.

> At the assembler level in Windows,


Nope. C level.

> when you open a file, Windows gives
> you an int handle to use to read/write. You don't specify the full
> filename each time or read or write, just the handle.


That is like almost all languages and all API's.

Arne


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: ValueError: filedescriptor out of range in select() Laszlo Nagy Python 0 03-17-2009 05:03 PM
ValueError: filedescriptor out of range in select() Laszlo Nagy Python 0 03-17-2009 02:04 PM
FILEDESCRIPTOR Structure question sarada7@gmail.com C++ 1 09-16-2006 03:13 AM
Re: filedescriptor out of range in select() Andrew Bennetts Python 5 06-30-2003 12:11 PM
filedescriptor out of range in select() Paolo Invernizzi Python 0 06-26-2003 07:45 AM



Advertisments