[brailleblaster] Re: byte arrays versus strings

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Fri, 10 Dec 2010 11:54:04 -0600

JohnB --
I understand what you are saying -- but there's still a sticking point.
The input, output, and error streams are declared as InputStream and 
OutputStream's, which are general streams that could take either byte arrays 
(for binary or general data) or character streams, which I understand can be 
put in a String class.  I am unsure what exactly the getInputStream(), 
getOutputStream() and getErrorStream() are returning as there are subclasses 
to class InputStream and OutputStream that cater to both kinds of data.  I 
am wondering if there is a way to query the type of subclass of a class of 
an object.  That would solve it.
Anyway, There might be uses of my class that want to do some kind of 
operation on a general data file.  For example, is there ever a graphic or 
other binary data embedded in what I would be sending through the program 
that would be spit back out on the output stream?

This is just a matter of understanding java from the ters online docs.  I 
could resort to one of the books I guess.  But I think the online docs 
should be enough.
--le






----- Original Message ----- 
From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
To: <brailleblaster@xxxxxxxxxxxxx>
Sent: Friday, December 10, 2010 1:29 AM
Subject: [brailleblaster] Re: byte arrays versus strings


Laura,

As I see it, your code should be written for generality, so it can be
used to calll other command-line filters. The input and output streams
should therefore be strings.

Another part of your code might take a stream containing a MathML
fragment and convert it to a JDOM subtree. This code might be useful in
other parts of BrailleBlaster, so it should  also be generalized.

Hope this helps,
John B.

On Thu, Dec 09, 2010 at 07:25:06PM -0600, qubit wrote:
> Ok, this is where I need JohnB's expertise with characters and byte 
> strings.
> Of course, anyone else can chime in too.
>
> I have a buffered stream going from brailleblaster to the input of process
> just spawned, and 2 streams coming back for standard error and standard 
> out.
>
> I will be managing the pipes in a class constructor / finalizer.
> My question is, in the docs for the input and output streams in java.io,
> there are subclasses that manage byte arrays and subclasses that do just
> character strings.
> My class will provide you with a read and a write method.  Should I just
> assume that everything that goes over the pipe is a character stream, or 
> are
> there cases where I can't assume that?
>
> Should this be a character stream or a byte stream?
> Should I use threads that handle the input and output on these streams?
>
> I am trying to get all my "ducks in a row" as a family member likes to 
> say.
> Any comments are welcome.
> --le
>

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities



Other related posts: