This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there an efficient way to read a text file into a string?

 
Tong Chen
Ranch Hand
Posts: 1011
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there an efficient way to read a text file into a string? or anybody can give me a sample code?
Thanks,
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Presizing the StringWriter is optional, but improves performance. Here I assumed that the file encoding was one byte per character. If that's not the case you may wish to presize differently - e.g. for UTF-16 use
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic