1:
30:
31: package ;
32:
33: import ;
34: import ;
35: import ;
36:
37: import ;
38: import ;
39: import ;
40: import ;
41:
42:
47: public class StreamContentItem implements ContentItem
48: {
49: private WrappedInputStream inputStream;
50: private WrappedOutputStream outputStream;
51: private ContentLocation parent;
52: private String name;
53:
54: public StreamContentItem(final String name,
55: final ContentLocation parent,
56: final WrappedInputStream inputStream,
57: final WrappedOutputStream outputStream)
58: {
59: this.name = name;
60: this.parent = parent;
61: this.inputStream = inputStream;
62: this.outputStream = outputStream;
63: }
64:
65: public boolean isReadable()
66: {
67: if (inputStream == null)
68: {
69: return false;
70: }
71: return inputStream.isClosed() == false;
72: }
73:
74: public boolean isWriteable()
75: {
76: if (outputStream == null)
77: {
78: return false;
79: }
80: return outputStream.isClosed() == false;
81: }
82:
83: public String getMimeType() throws ContentIOException
84: {
85: return getRepository().getMimeRegistry().getMimeType(this);
86: }
87:
88: public OutputStream getOutputStream() throws ContentIOException, IOException
89: {
90: return outputStream;
91: }
92:
93: public InputStream getInputStream() throws ContentIOException, IOException
94: {
95: return inputStream;
96: }
97:
98: public String getName()
99: {
100: return name;
101: }
102:
103: public Object getContentId()
104: {
105: return name;
106: }
107:
108: public Object getAttribute(final String domain, final String key)
109: {
110: return null;
111: }
112:
113: public boolean setAttribute(final String domain, final String key, final Object value)
114: {
115: return false;
116: }
117:
118: public ContentLocation getParent()
119: {
120: return parent;
121: }
122:
123: public Repository getRepository()
124: {
125: return parent.getRepository();
126: }
127:
128: public boolean delete()
129: {
130: return false;
131: }
132: }