Prev: SocketHandler permissions Re: servlet/applet communication problemor Linux/Windows trouble ?
Next: sha256sum and (new BigInteger(1, MD.digest())).toString(16) not listing exactly the same ...
From: Albretch Mueller on 26 Dec 2009 00:10 Hi, ~ I just have a short one liner with the sha sum of a file, but Properties.list(System.err) is not actually listing it. On the API: ~ http://java.sun.com/javase/6/docs/api/java/util/Properties.html#list(java.io.PrintStream) ~ it just says: ~ "Prints this property list out to the specified output stream. This method is useful for debugging." ~ Why is that? Do I somehow have a corruted System.err? ~ Thanks lbrtchx
From: John B. Matthews on 26 Dec 2009 05:35 In article <a7c1dce6-bae2-44a2-a49a-3f292efbbfb8(a)g26g2000yqe.googlegroups.com>, Albretch Mueller <lbrtchx(a)gmail.com> wrote: > Hi, > ~ > I just have a short one liner with the sha sum of a file, but > Properties.list(System.err) is not actually listing it. On the API: > ~ > http://java.sun.com/javase/6/docs/api/java/util/Properties.html > ~ > it just says: > ~ > "Prints this property list out to the specified output stream. > This method is useful for debugging." I was mildly surprised to see list() elide long lines with "...", for exampleSystem.getProperties(), excerpted: sun.arch.data.model=32 java.home=/System/Library/Frameworks/JavaVM.fra... java.specification.vendor=Sun Microsystems Inc. In any case, store(System.out, null) shows the full property. Any chance your file has non-native line endings? [...] -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
From: Albretch Mueller on 26 Dec 2009 09:25 John B. Matthews wrote: > Any chance your file has non-native line endings? ~ Well, no. It is not about any file. Actually the value I set is just a 64 byte long string with the base 16 SHA-256 signature of a file ~ It beats me why sun doesn't just list what is in the prop file as they specify. ~ java.util.Properties().getProperty("aPropName") ~ does give you what you ask for but I think that "list" unconcistency is some bug or oversight on sun's side. They should fix that ~ lbrtchx
From: John B. Matthews on 26 Dec 2009 11:57 In article <1a079e94-7e3b-42a7-948c-99ae0cbd6e14(a)z41g2000yqz.googlegroups.com>, Albretch Mueller <lbrtchx(a)gmail.com> wrote: [...] > It beats me why sun doesn't just list what is in the prop file as > they specify. > ~ > java.util.Properties().getProperty("aPropName") > ~ > does give you what you ask for but I think that "list" unconcistency > is some bug or oversight on sun's side. They should fix that I can see the virtue of a utility method that truncates long lines for readability or economy. If it's a feature, they might document it a little better. -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
From: Roedy Green on 28 Dec 2009 09:36
On Sat, 26 Dec 2009 06:25:08 -0800 (PST), Albretch Mueller <lbrtchx(a)gmail.com> wrote, quoted or indirectly quoted someone who said : > Well, no. It is not about any file. Actually the value I set is just >a 64 byte long string with the base 16 SHA-256 signature of a file >~ > It beats me why sun doesn't just list what is in the prop file as >they specify. >~ http://mindprod.com/jgloss/properties.html A Properties object is like an enhanced HashSet/Hashtable. It is just a list of keys and values held totally in RAM. You can save/restore the list to a text file. System.getProperties() gets you a special Properties object that contains various configuration information. If you only have one value, it does not make any sense to be using a Properties (plural) object. -- Roedy Green Canadian Mind Products http://mindprod.com If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. |