1 package org.ozoneDB.tools.OPP.srcgen.streamfactory; 9 10 import java.io.OutputStream ; 11 import java.io.IOException ; 12 import java.io.ByteArrayOutputStream ; 13 import java.util.*; 14 15 16 20 public class ArrayOutputStreamFactory implements OutputStreamFactory { 21 private List arrayStreams = new LinkedList(); 22 23 public List getArrays() { 24 List arrays = new ArrayList(arrayStreams.size()); 25 for (Iterator iterator = arrayStreams.iterator(); iterator.hasNext();) { 26 ByteArrayOutputStream stream = (ByteArrayOutputStream ) iterator.next(); 27 arrays.add(stream.toByteArray()); 28 } 29 return arrays; 30 } 31 32 public void clear() { 33 arrayStreams.clear(); 34 } 35 36 public OutputStream newInstance(String className) throws IOException { 37 38 ByteArrayOutputStream os = new ByteArrayOutputStream (); 39 arrayStreams.add(os); 40 return os; 41 } 42 } 43 | Popular Tags |