#1740 Size limit in OutStream.writeUtf(str)?

sime Wed 21 Dec 2011

Hello,

I was playing around with a little test program last night and got this:

sys::IOErr: String too big
  fan.sys.OutStream.writeUtf (OutStream.java:191)
  fantomwikiscraper::WikiFetcher.putInCache (WikiFetcher.fan:50)
  ...

The string I wanted to write was fairly big, 10s of KB. The docs didn't mention anything about a size limit, so this looks like a code or doc bug to me.

The code is roughly like this:

fhandle := `/home/sbe/cache/blah`.toFile().out
fhandle.writeUtf(bigString)
fhandle.close

This is on platform:

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

cheers,

Simon

brian Wed 21 Dec 2011

The docs didn't mention anything about a size limit, so this looks like a code or doc bug to me.

The docs do say it works like java.io.DataOutput.writeUtf which has same size limitation because it encodes the length using 16-bits.

But looking at your code, you probably just want to call print, writeUtf is really only for binary encodings. By default all output streams print using UTF-8 unless you explictly change charset.

sime Wed 21 Dec 2011

Thanks for the quick reply brian.

Xan Wed 11 Jan 2012

sime,

just curious: what's the solution for your problem? how to fix it?

Thanks,

Login or Signup to reply.