Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19268 > unrolled thread

FileDescriptor

Started bybob smith <bob@coolfone.comze.com>
First post2012-10-12 15:23 -0700
Last post2012-10-13 18:57 -0400
Articles 5 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  FileDescriptor bob smith <bob@coolfone.comze.com> - 2012-10-12 15:23 -0700
    Re: FileDescriptor Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-10-12 15:32 -0700
    Re: FileDescriptor Arne Vajhøj <arne@vajhoej.dk> - 2012-10-12 21:18 -0400
    Re: FileDescriptor Roedy Green <see_website@mindprod.com.invalid> - 2012-10-13 13:58 -0700
      Re: FileDescriptor Arne Vajhoej <arne@vajhoej.dk> - 2012-10-13 18:57 -0400

#19268 — FileDescriptor

Frombob smith <bob@coolfone.comze.com>
Date2012-10-12 15:23 -0700
SubjectFileDescriptor
Message-ID<1c2e24f4-b4db-41b8-9139-f6ada096e8de@googlegroups.com>
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?

[toc] | [next] | [standalone]


#19269

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-10-12 15:32 -0700
Message-ID<hU0es.14572$sB3.13799@newsfe05.iad>
In reply to#19268
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.

[toc] | [prev] | [next] | [standalone]


#19270

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-12 21:18 -0400
Message-ID<5078c168$0$284$14726298@news.sunsite.dk>
In reply to#19268
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


[toc] | [prev] | [next] | [standalone]


#19306

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-10-13 13:58 -0700
Message-ID<lalj78lvvr591vbirog1a18g2qpkevgn2n@4ax.com>
In reply to#19268
On Fri, 12 Oct 2012 15:23:37 -0700 (PDT), bob smith
<bob@coolfone.comze.com> 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. 

[toc] | [prev] | [next] | [standalone]


#19314

FromArne Vajhoej <arne@vajhoej.dk>
Date2012-10-13 18:57 -0400
Message-ID<5079f1d3$0$294$14726298@news.sunsite.dk>
In reply to#19306
On 10/13/2012 4:58 PM, Roedy Green wrote:
> On Fri, 12 Oct 2012 15:23:37 -0700 (PDT), bob smith
> <bob@coolfone.comze.com> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web