FileDocCategorySizeDatePackage
LoopPrinterUnsafe.javaAPI DocExample916Thu Mar 11 19:50:52 GMT 2004javathreads.examples.ch15

LoopPrinterUnsafe

public class LoopPrinterUnsafe extends Object

Fields Summary
private Vector[]
pStorage
Constructors Summary
public LoopPrinterUnsafe(int size)

        pStorage = new Vector[size];
    
Methods Summary
public voidprint(int index, java.lang.Object obj)

        if (pStorage[index] == null) {
            pStorage[index] = new Vector();
        }
        pStorage[index].addElement(obj.toString());
    
public voidprintln(int index, java.lang.Object obj)

        print(index, obj);
        print(index, "\n");
    
public voidsend2stream(java.io.PrintStream ps)

        for (int i = 0; i < pStorage.length; i++) {
            if (pStorage[i] != null) {
                Enumeration e = pStorage[i].elements();
                while (e.hasMoreElements()) {
                    ps.print(e.nextElement());
                }
            }
        }