1 16 package org.apache.commons.vfs.provider; 17 18 import org.apache.commons.vfs.FileSystemException; 19 import org.apache.commons.vfs.RandomAccessContent; 20 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 import java.util.ArrayList ; 24 25 28 class FileContentThreadData 29 { 30 32 private final ArrayList instrs = new ArrayList (); 33 private DefaultFileContent.FileContentOutputStream outstr; 34 private RandomAccessContent rastr; 35 36 FileContentThreadData() 37 { 38 } 39 40 51 52 void addInstr(InputStream is) 53 { 54 this.instrs.add(is); 55 } 56 57 void setOutstr(DefaultFileContent.FileContentOutputStream os) 58 { 59 this.outstr = os; 60 } 61 62 DefaultFileContent.FileContentOutputStream getOutstr() 63 { 64 return this.outstr; 65 } 66 67 void setRastr(RandomAccessContent ras) 68 { 69 this.rastr = ras; 70 } 71 72 int getInstrsSize() 73 { 74 return this.instrs.size(); 75 } 76 77 public Object removeInstr(int pos) 78 { 79 return this.instrs.remove(pos); 80 } 81 82 public void removeInstr(InputStream instr) 83 { 84 this.instrs.remove(instr); 85 } 86 87 public RandomAccessContent getRastr() 88 { 89 return this.rastr; 90 } 91 92 public boolean hasStreams() 93 { 94 return instrs.size() > 0 || outstr != null || rastr != null; 95 } 96 97 public void closeOutstr() throws FileSystemException 98 { 99 outstr.close(); 100 outstr = null; 101 } 102 103 public void closeRastr() throws IOException 104 { 105 rastr.close(); 106 rastr = null; 107 } 108 } 109 | Popular Tags |