1 9 10 package org.jboss.util.stream; 11 12 import java.io.IOException ; 13 import java.io.ObjectOutputStream ; 14 import java.io.OutputStream ; 15 16 28 public class AppendingObjectOutputStream 29 extends ObjectOutputStreamAdapter 30 { 31 41 public AppendingObjectOutputStream(OutputStream out, boolean append) 42 throws IOException 43 { 44 super(createStream(out, append)); 45 } 46 47 50 private static ObjectOutputStream createStream(OutputStream out, 51 boolean append) 52 throws IOException 53 { 54 ObjectOutputStream stream; 55 56 if (append) { 58 stream = new AppendObjectOutputStream(out); 59 } 60 else if (out instanceof ObjectOutputStream ) { 62 stream = (ObjectOutputStream )out; 63 } 64 else { 66 stream = new ObjectOutputStream (out); 67 } 68 69 return stream; 70 } 71 } 72 | Popular Tags |