velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: Writing to File
Date Wed, 06 Apr 2005 18:30:20 GMT
Hi Sashi,

Let's keep the discussion on the list.  I'm not the only one with
great ideas.  :)

>  I am trying something ike this
> 
>  $templet.getValue("name")
> 
>  which returns byte[]
> 
>  using following
> 
> Writer writer = new BufferedWriter(new OutputStreamWriter(new
> FileOutputStream(fileName)));
> if ( template != null)
>    template.merge(context, writer);
> 
> But the output value is some thing like this [B@6b21959a (calling toString
> on byte[])  but its not actually writing the byte array.

Because that's how it was meant to be.  I don't think there's a tool
currently to convert byte arrays to Strings, but it can be made
easily.  The constructor of String can be used.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#String(byte[],
java.lang.String)

Best regards,
-- Shinobu

--
Shinobu Kawai <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message