thanks. It is coming along. I just bit off a bit of learning curve with this package, so I hope no one thinks it's too bad... If you want you can all come to MN and throw snowballs at my house -- if you can get to my house -- we just had a foot or more fall in a very short time. --le ----- Original Message ----- From: "Chris von See" <chris@xxxxxxxxxxxxx> To: <brailleblaster@xxxxxxxxxxxxx> Sent: Saturday, December 11, 2010 9:25 PM Subject: [brailleblaster] Re: java Byte arrays and string literals You may have already figured this out, but in case you haven't... You can "cheat" and do something like this - byte[] testBytes = "This is a test".getBytes(); or use one of the variations that allow you to set the character encoding, such as: byte[] testBytes = "This is a test".getBytes("UTF-8"); Creating String objects from byte arrays is also very easy - you can use one of the String constructors that takes a byte array. Cheers Chris On Dec 11, 2010, at 6:37 PM, qubit wrote: > 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 > >