1 21 package proguard.io; 22 23 import proguard.util.*; 24 25 import java.io.*; 26 27 33 public class CascadingDataEntryWriter implements DataEntryWriter 34 { 35 private DataEntryWriter dataEntryWriter1; 36 private DataEntryWriter dataEntryWriter2; 37 38 39 47 public CascadingDataEntryWriter(DataEntryWriter dataEntryWriter1, 48 DataEntryWriter dataEntryWriter2) 49 { 50 this.dataEntryWriter1 = dataEntryWriter1; 51 this.dataEntryWriter2 = dataEntryWriter2; 52 } 53 54 55 57 public OutputStream getOutputStream(DataEntry dataEntry) throws IOException 58 { 59 return getOutputStream(dataEntry, null); 60 } 61 62 63 public OutputStream getOutputStream(DataEntry dataEntry, 64 Finisher finisher) throws IOException 65 { 66 OutputStream outputStream = 68 dataEntryWriter1.getOutputStream(dataEntry, finisher); 69 70 return outputStream != null ? 73 outputStream : 74 dataEntryWriter2.getOutputStream(dataEntry, finisher); 75 } 76 77 78 public void close() throws IOException 79 { 80 dataEntryWriter1.close(); 81 dataEntryWriter2.close(); 82 83 dataEntryWriter1 = null; 84 dataEntryWriter2 = null; 85 } 86 } 87 | Popular Tags |