This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

output stream bug


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 <*>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]