Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15562
| From | "Qu0ll" <Qu0llSixFour@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| References | <l5KdnS_4P9pgoHrSnZ2dnUVZ_uGdnZ2d@westnet.com.au> <a4ov8oF930U1@mid.individual.net> <PJednaie7P_-0HrSnZ2dnUVZ_hSdnZ2d@westnet.com.au> <nb1dv4z3gq48.15acrjvtu4vh2.dlg@40tude.net> |
| Subject | Re: Local vs. network file |
| Date | 2012-06-25 04:01 +1000 |
| Message-ID | <yqidncZLM--8y3rSnZ2dnUVZ_j2dnZ2d@westnet.com.au> (permalink) |
Sorry about the lack of indentation, reply at the end... "Peter Duniho" wrote in message news:nb1dv4z3gq48.15acrjvtu4vh2.dlg@40tude.net... On Mon, 25 Jun 2012 03:24:22 +1000, Qu0ll wrote: > "Robert Klemme" wrote in message news:a4ov8oF930U1@mid.individual.net... > > On 24.06.2012 18:18, Qu0ll wrote: >>> Is it possible to determine if a given String contains the path of a >>> file on a network drive (versus a local file) in Java 7? >> >> Yes. > > OK, thanks for the confirmation. How is it done? Actually, I doubt you can do this in a platform-independent way. Even on Windows, a UNC path (which is normally used to specify a network path) can refer to a local drive and a drive-letter path can refer to a network location. You need to use platform-specific calls to tell the difference. I'm less familiar with the *nix family, but my recollection is that because of its even-more-generalized file system implementation, the path itself is of no use. You'd also have to use lower-level OS-specific calls to get that information. That said, while it's true that there can be somewhat different i/o characteristics between local and network files, I'm not convinced a program should attempt to concern itself with them. As networks become faster and faster, and more and more reliable, network-specific restrictions in a program are much less appropriate, and at the same time while delays and errors on local drives are rare, they can and do occur and a program should handle them correctly. Perhaps if you explain why it is you believe you need to know the difference between a local and a network path, you can get better advice that addresses your _actual_ problem, rather than does or does not solve some specific method you've already selected to deal with that problem. ---------------------------------- Thanks Peter. I have a requirement to limit a program which is licensed as "stand alone" to not be run from a network location so I figured if I could tell whether the launch directory was a network share then I could block it. Is there another way I could implement this? -- And loving it, -Qu0ll (Rare, not extinct) _________________________________________________ Qu0llSixFour@gmail.com [Replace the "SixFour" with numbers to email me]
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 02:18 +1000
Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 18:57 +0200
Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 03:24 +1000
Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-24 10:49 -0700
Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-25 04:01 +1000
Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-24 14:12 -0400
Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 20:20 +0200
Re: Local vs. network file Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-24 14:26 -0500
Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-06-24 20:14 +0200
Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-24 13:10 -0700
Re: Local vs. network file "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-06-28 19:10 +1000
Re: Local vs. network file Silvio Bierman <silvio@moc.com> - 2012-06-28 11:39 +0200
Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-06-28 07:31 -0700
Re: Local vs. network file Robert Klemme <shortcutter@googlemail.com> - 2012-07-02 19:33 +0200
Re: Local vs. network file Joerg Meier <joergmmeier@arcor.de> - 2012-07-02 21:49 +0200
Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-02 16:18 -0400
Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-07-02 13:32 -0700
Re: Local vs. network file Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-02 18:32 -0400
Re: Local vs. network file Lew <lewbloch@gmail.com> - 2012-07-02 16:25 -0700
Re: Local vs. network file Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-07-02 17:35 -0700
Re: Local vs. network file Nine of Seventeen <n9seventeen17@gmail.com> - 2012-07-02 21:10 -0400
Re: Local vs. network file uBend <d0b@d1b.d1b.null> - 2012-07-02 22:45 -0400
Re: Local vs. network file j00sUck <j00-s.U-c_k@gmail.com> - 2012-07-02 22:59 -0400
csiph-web