[brailleblaster] java Byte arrays and string literals

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Sat, 11 Dec 2010 20:37:30 -0600

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: