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


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

java.io.File

Started byMark <i@dontgetlotsofspamanymore.net>
First post2011-12-02 09:35 +0000
Last post2011-12-06 09:23 -0800
Articles 3 on this page of 23 — 8 participants

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


Contents

  java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-02 09:35 +0000
    Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-02 07:25 -0800
      Re: java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-02 15:55 +0000
        Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-02 08:17 -0800
          Re: java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-02 16:31 +0000
            Re: java.io.File markspace <-@.> - 2011-12-02 08:53 -0800
            Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-02 14:02 -0800
              Re: java.io.File Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 17:12 -0500
                Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-02 14:16 -0800
                  Re: java.io.File Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 18:42 -0500
                    Re: java.io.File Lars Enderin <lars.enderin@telia.com> - 2011-12-03 01:06 +0100
                  Re: java.io.File Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-12-07 15:51 +0200
              Re: java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-05 15:14 +0000
                Re: java.io.File markspace <-@.> - 2011-12-05 07:49 -0800
                  Re: java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-05 16:28 +0000
                Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-05 15:25 -0800
                  Re: java.io.File Mark <i@dontgetlotsofspamanymore.net> - 2011-12-06 10:29 +0000
            Re: java.io.File Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 17:08 -0500
        Re: java.io.File Roedy Green <see_website@mindprod.com.invalid> - 2011-12-03 00:57 -0800
      Re: java.io.File Mayeul <mayeul.marguet@free.fr> - 2011-12-02 17:33 +0100
        Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-02 14:07 -0800
          Re: java.io.File Mayeul <mayeul.marguet@free.fr> - 2011-12-06 15:52 +0100
            Re: java.io.File Lew <lewbloch@gmail.com> - 2011-12-06 09:23 -0800

Page 2 of 2 — ← Prev page 1 [2]


#10438

FromLew <lewbloch@gmail.com>
Date2011-12-02 14:07 -0800
Message-ID<3749375.667.1322863677698.JavaMail.geo-discussion-forums@preu18>
In reply to#10429
Mayeul wrote:
>Lew wrote:
>> Mark wrote:
>>> Can a java.io.File object use a OS file descriptor?  I am trying to
>>> find the source of a fd leak in a[n] application.
>>
>> At some point, depending on the operations performed by the 'File' instance, there may be a file descriptor involved, and then the 'File' instance certainly does use it, at least indirectly via JVM system calls that proxy to OS system calls.
> 
> It was my understanding that java.io.File instances were merely 
> representations of pathnames, and are neither closed nor opened, just 
> places and names where files could exist or not.

How, then, do calls like 'File#canRead()', 'canWrite()', 'createNewFile()', 'createTempFile()', 'delete()', 'exists()', 'getFreeSpace()', 'isDirectory()', 'isFile()', 'list()', 'listFiles()', 'mkdir()', 'mkdirs()', 'setReadable()', 'setReadOnly()' and 'setWritable()' work?

> It was also my understanding that file descriptors were representations 
> of opened files.

Maybe those operations don't use file descriptors, but they do use OS filesystem resources.

-- 
Lew

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


#10553

FromMayeul <mayeul.marguet@free.fr>
Date2011-12-06 15:52 +0100
Message-ID<4ede2a90$0$21836$426a74cc@news.free.fr>
In reply to#10438
On 02/12/2011 23:07, Lew wrote:
> Mayeul wrote:
>> Lew wrote:
>>> Mark wrote:
>>>> Can a java.io.File object use a OS file descriptor?  I am trying to
>>>> find the source of a fd leak in a[n] application.
>>>
>>> At some point, depending on the operations performed by the 'File' instance, there may be a file descriptor involved, and then the 'File' instance certainly does use it, at least indirectly via JVM system calls that proxy to OS system calls.
>>
>> It was my understanding that java.io.File instances were merely
>> representations of pathnames, and are neither closed nor opened, just
>> places and names where files could exist or not.
>
> How, then, do calls like 'File#canRead()', 'canWrite()', 'createNewFile()', 'createTempFile()', 'delete()', 'exists()', 'getFreeSpace()', 'isDirectory()', 'isFile()', 'list()', 'listFiles()', 'mkdir()', 'mkdirs()', 'setReadable()', 'setReadOnly()' and 'setWritable()' work?

I would have said, by merely looking up files or trying to create files 
of the pathname the instance represents. But maybe my poor English 
communication skills are getting in the way.

>> It was also my understanding that file descriptors were representations
>> of opened files.
>
> Maybe those operations don't use file descriptors, but they do use OS filesystem resources.

Those operations obviously do, but it seemed to me they were loosely 
tied to the internal state of java.io.File instances.

--
Mayeul

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


#10563

FromLew <lewbloch@gmail.com>
Date2011-12-06 09:23 -0800
Message-ID<9355143.259.1323192192716.JavaMail.geo-discussion-forums@prgk20>
In reply to#10553
Mayeul wrote:
> Lew wrote:
>> How, then, do calls like 'File#canRead()', 'canWrite()', 'createNewFile()', 
>> 'createTempFile()', 'delete()', 'exists()', 'getFreeSpace()', 
>> 'isDirectory()', 'isFile()', 'list()', 'listFiles()', 'mkdir()', 'mkdirs()', 
>> 'setReadable()', 'setReadOnly()' and 'setWritable()' work?
> 
> I would have said, by merely looking up files or trying to create files 
> of the pathname the instance represents. But maybe my poor English 
> communication skills are getting in the way.

The word "merely" is a dodge.  "Looking up" and "trying to create" involve 
system calls to the OS.  The 'File' object has methods that affect and report 
on the state of the real world, not just the abstract pathname, so obviously in 
order to do that it has to interact with system calls.  Perhaps they aren't 
file descriptors through which the instance asks a directory what files it 
lists, or by which it creates a temporary file, but they sure as heck are 
resources that have to be released.

>> Maybe those operations don't use file descriptors, but they do use OS 
>> filesystem resources.
> 
> Those operations obviously do, but it seemed to me they were loosely 
> tied to the internal state of java.io.File instances.

And therefore ...?

Clearly they are tied to the 'File' instance state, and not "loosely", either.  
That is just as clear as that these operations interact with the file system 
and therefore use OS resources.

It is puzzling to me how anyone can make the argument that an object is 
independent of the file system while acknowledging that it interacts with the 
file system.  Sure, 'File' doesn't have a 'close()' method, but it has 
operations that open things.  One assumes that such operations are RAII, but 
one also recognizes that this is an assumption.

-- 
Lew

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web