[m-rev.] For review: Java implementation of IO library

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 14 14:28:52 AEDT 2004


On 14-Jan-2004, James Goddard <goddardjames at yahoo.com> wrote:
> > > +				} else {
> > > +					randomaccess.write(s.getBytes());
> > 
> > The documentation for getBytes says "The behavior of this method when
> > this string cannot be encoded in the default charset is unspecified."
> > That is not good.  At very least there should be an XXX here.
> > But it would be better to throw an exception if the string cannot
> > be encoded.
> 
> The new implementation only uses getBytes() for binary files, which should be
> ok since we don't expect people to call write(String) on a binary file.  I've
> added that XXX just in case.

OK.

> Would it be better just to throw an exception if
> they try to write text to a binary file?

No; io__write_binary writes text to a binary file,
because it is implemented using io__write.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list