[brailleblaster] Re: java Byte arrays and string literals

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Sat, 11 Dec 2010 23:05:11 -0500

Why are you using streams in the first place?

Take a step back and examine the problem here. Can't this be simply 
accomplished  by giving those things an object?

Barring that ... Giving them the whole stream, and letting them pump in/out 
what they need?

Take care,
Sina

-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx 
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Saturday, December 11, 2010 9:38 PM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] java Byte arrays and string literals

Hi -- ok,
Sina, on the other list you said I was taking the wrong approach.  That is 
altogether possible as I am pushing up against a few
awkward bits of code that should not be necessary, IMO, and I think you agree.

The awkwardness I am experiencing comes when a method needs to call another 
method from another package, not written by me.
My class is now compiling, and I think should work, but I am having problems 
with the test.main method.
What I'm wondering is either how to initialize this Byte array with the 
characters of "This is a test.".
javac keeps barfing on that.
I pass this byte array to a method in my class, as input to the OutputStream I 
am writing to. The reason I am passing this is
because the OutputStream/InputStream classes and their descendants contain the 
following definitions respectively:
void write(Byte[] buf, int startPos, int len ) int  read(Byte[] buf, int 
startPos, len);

Comments?
TIA
--le 



Other related posts: