OT: copying binary data with Reader/Writer (rather than Stream)
Hello, (forgive me since this is mostly off topic, though the answer might possibly be specific to the operating system.) I want to write a little java app to copy a url and its relative links. The url itself is a text html file; some of the links may be binary files such as .jpg, .ps.gz, etc. My question: can you copy a binary file such as a .jpg using a *Reader, rather than a Stream? Each byte will then be represented with a 16bit char, but will writing with a corresponding Writer preserve the data? Generally the top-level url should be read using a Reader, but I believe it will be difficult to tell if the links are binary or html without reading them (and even then... some html does not start with the tag. Thus, the easy/general way to do it would be to just open every file with a Reader, thus my question. Any other approaches? Thanks. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: OT: copying binary data with Reader/Writer (rather than Stream)
Hallo! On Sun, 31 Dec 2000, noisebrain wrote: > (forgive me since this is mostly off topic, though the answer > might possibly be specific to the operating system.) > > I want to write a little java app to copy a url and its relative links. > The url itself is a text html file; some of the links may be binary > files such as .jpg, .ps.gz, etc. > > My question: can you copy a binary file such as a .jpg using a *Reader, > rather than a Stream? Each byte will then be represented with > a 16bit char, but will writing with a corresponding Writer preserve the > data? > > Generally the top-level url should be read using a Reader, > but I believe it will be difficult to tell if the links are binary > or html without reading them (and even then... some html does not > start with the tag. Thus, the easy/general way to do it would > be to just open every file with a Reader, thus my question. The Writer shouldn't change something, as far as I remember, what the Reader read, but I am not sure what will happen if You come across a file that is *not* 16 bit-aligned. -- Bye... Andreas Kopecki Benutzerberater Emacs [EMAIL PROTECTED] http://www.uni-stuttgart.de/WWWraum/goodies.html - If it's really a rush job, run in and interrupt me every 10 minutes to inquire how it's going. That helps. Or even better, hover behind me, advising me at every keystroke. -- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: OT: copying binary data with Reader/Writer (rather than Stream)
noisebrain wrote: > Hello, > > (forgive me since this is mostly off topic, though the answer > might possibly be specific to the operating system.) > > I want to write a little java app to copy a url and its relative links. > The url itself is a text html file; some of the links may be binary > files such as .jpg, .ps.gz, etc. > > My question: can you copy a binary file such as a .jpg using a *Reader, > rather than a Stream? Each byte will then be represented with > a 16bit char, but will writing with a corresponding Writer preserve the > data? If you're going to be reasonably clever about this copy, there are a couple of reasonable things to do here: 1) Use streams everywhere - don't count on what Reader/Writer may or may not do to data that doesn't represent a known text encoding. If you need to interpret the data as text (such as reading html and interpreting the links), you can pump it through another pipeline that will apply the appropriate text encoding. That pipeline might, for example, consist of a piped stream feeding an InputStreamReader. 2) Don't ignore the header fields of the HTTP objects you retrieve. Except for ancient or strange Web servers, they'll contain a Content-Type field that will tell you whether or not the object is text/http. These recommendations should apply across all platforms (which makes this one of those dreaded, generic, off-topic questions :-). Nathan > > > Generally the top-level url should be read using a Reader, > but I believe it will be difficult to tell if the links are binary > or html without reading them (and even then... some html does not > start with the tag. Thus, the easy/general way to do it would > be to just open every file with a Reader, thus my question. > > Any other approaches? > > Thanks. > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Netbeans debugger not working with JDK1.3
Because you approached this subject , may I ask please : Does the java debugger(j2sdk1.3, blackdown ) work at all on Linux platform (Debian Potatoe) ? What happens is that jdb get frozen.If run "threadlocks" this is the retrieved message. VM Started: threadlocks Internal exception: java.lang.NullPointerException at com.sun.tools.example.debug.tty.Commands.commandThreadlocks(Commands.java:15 19) at com.sun.tools.example.debug.tty.TTY.executeCommand(TTY.java:431) at com.sun.tools.example.debug.tty.TTY.(TTY.java:625) at com.sun.tools.example.debug.tty.TTY.main(TTY.java:924). I asked the same question on Debian mailing list , but no answer. Can anybody please guide me please , haw to make jdb work ? Thank you for your participation. Florentin - Original Message - From: "Stephan Jaensch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 26, 2000 4:14 PM Subject: Netbeans debugger not working with JDK1.3 > Hi everybody, > > > I guess it is known that the Blackdown JDK 1.3 does not work reliably with > the Forte/Netbeans debugger, the JVM crashes hard after a few seconds of > step-debugging. I would switch to the IBM JDK, but I can't debug JMF > applications with it (it cannot find the codecs, and the README says a > Sun/Blackdown JDK is needed). > > The Forte debugger works well with SUNs JDK, but because of the keyboard > issues the SUN JDK is not usable for me. > > Any suggestions, eg. > - how to use the JMF with IBM's JDK > - what to do to make the Blackdown JDK work with Forte's debugger > - or something like "wait another X days/weeks, a modified SUN/Blackdown > JDK which resolves these issues will be released" > > Any help is greatly appreciated. > > > Cheers > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]