output stream bug

jmc@cmpharm.ucsf.edu jmc@cmpharm.ucsf.edu
Tue Jun 15 17:29:00 GMT 1999


Hi,
There seems to be a bug when mixing write(byte) and write(byte[])
calls to output streams. In a JVM, the following code writes
"XoooXooo" like it should; in gcj compiled output, it writes
"ooooooXX". I'm using the 6/8/99 snapshots of egcs and libgcj,
compiled with --enable-fast-character --enable-threads=posix, on
a linux 2.2.10 box.
import java.io.*;
public class TestStreams {
 final public static byte[] ooo =
 new String("ooo").getBytes();
 
 final public static void main(String[] argv) {
	try {
	 System.out.write('X');
	 System.out.write(ooo);
	 System.out.write('X');
	 System.out.write(ooo);
	 System.out.flush();
	}
	catch (IOException e) {
	 System.out.println("This doesn't happen.");
	}
 }
}
I still haven't succeeded in compiling libgcj on a SGI, due to bugs
discussed earlier on this list, so I don't know if this happens
on other systems.
Thanks,
JMC
-- 
John-Marc Chandonia (jmc@cmpharm.ucsf.edu) We're everywhere...
Cohen Lab, University of California San Francisco for your convenience.
http://yuri.harvard.edu/~jmc -- Psi Corps <*>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /