You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by prabhakar thopa <pr...@yahoo.com> on 2007/01/02 15:46:00 UTC
Re: Velocity & FileWriter 32K limit?
Thank you mailmur.
Using fw.flush and fw.close did solve my problem.
Regards,
Prabhakar
----- Original Message ----
From: mailmur <ma...@yahoo.com>
To: Velocity Users List <us...@velocity.apache.org>
Sent: Saturday, December 30, 2006 8:36:24 AM
Subject: Re: Velocity & FileWriter 32K limit?
> I am using velocity to generate sql. When I use a
> StringWriter generation is full and is displayed
> correctly in console. However when I use a
> java.io.FileWriter, the generated file does not
> contain all data, and gets truncated after 32K.
> //Works fine
> StringWriter sw = new StringWriter();
>
Velocity.mergeTemplate("velocityTemplate.vm","ISO-8859-1",context,sw);
> System.out.println(sw);
>
> //Output truncated after 32K
> File file = new
> File("c:\velcoityOutput.txt");
> FileWriter fw = new FileWriter(file);
>
>
Velocity.mergeTemplate("apptext.vm","ISO-8859-1",context,fw);
> }
Velocity or FileWriter classes don't have 32k limits,
so must be something else.
Try calling "fw.flush(); fw.close();" after merging a
template and context. Good practise is to call flush
even if you use StringWriter thus its not actually
needed for it.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org