1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs.provider;
18
19 import org.apache.commons.vfs.FileSystemException;
20 import org.apache.commons.vfs.RandomAccessContent;
21
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.util.ArrayList;
25
26 /***
27 * Holds the data which needs to be local to the current thread
28 */
29 class FileContentThreadData
30 {
31
32
33 private final ArrayList instrs = new ArrayList();
34 private final ArrayList rastrs = new ArrayList();
35 private DefaultFileContent.FileContentOutputStream outstr;
36
37 FileContentThreadData()
38 {
39 }
40
41
42
43
44
45
46
47
48
49
50
51
52
53 void addInstr(InputStream is)
54 {
55 this.instrs.add(is);
56 }
57
58 void setOutstr(DefaultFileContent.FileContentOutputStream os)
59 {
60 this.outstr = os;
61 }
62
63 DefaultFileContent.FileContentOutputStream getOutstr()
64 {
65 return this.outstr;
66 }
67
68 void addRastr(RandomAccessContent ras)
69 {
70 this.rastrs.add(ras);
71 }
72
73 int getInstrsSize()
74 {
75 return this.instrs.size();
76 }
77
78 public Object removeInstr(int pos)
79 {
80 return this.instrs.remove(pos);
81 }
82
83 public void removeInstr(InputStream instr)
84 {
85 this.instrs.remove(instr);
86 }
87
88 public Object removeRastr(int pos)
89 {
90 return this.rastrs.remove(pos);
91 }
92
93 public void removeRastr(RandomAccessContent ras)
94 {
95 this.instrs.remove(ras);
96 }
97
98 public boolean hasStreams()
99 {
100 return instrs.size() > 0 || outstr != null || rastrs.size() > 0;
101 }
102
103 public void closeOutstr() throws FileSystemException
104 {
105 outstr.close();
106 outstr = null;
107 }
108
109 int getRastrsSize()
110 {
111 return rastrs.size();
112 }
113 }