90 |
return ((PointerIndexType.Index)index).getPointer(uri); |
return ((PointerIndexType.Index)index).getPointer(uri); |
91 |
} |
} |
92 |
|
|
|
/** |
|
|
* <code>block</code> and <code>closed</code> |
|
|
* must be set by <code>close()</code>. |
|
|
*/ |
|
93 |
protected abstract class AbstractBlockOutputStream |
protected abstract class AbstractBlockOutputStream |
94 |
extends BlockOutputStream { |
extends BlockOutputStream { |
95 |
|
|
96 |
protected Header822 header; |
protected Header822 header; |
97 |
protected Block block; |
protected Block block; |
98 |
protected boolean closed = false; |
|
99 |
|
/** Whether <code>close()</code> has already been called. |
100 |
|
* If <code>false</code>, <code>getBlock()</code> and so on |
101 |
|
* cannot be called yet. |
102 |
|
*/ |
103 |
|
protected boolean closed; |
104 |
|
|
105 |
/** Create a new AbstractBlockOutputStream object |
/** Create a new AbstractBlockOutputStream object |
106 |
* and write the given header to it. |
* and write the given header to it. |
113 |
header.writeTo(this); |
header.writeTo(this); |
114 |
} |
} |
115 |
|
|
116 |
|
public void close() throws IOException { |
117 |
|
if(closed) return; |
118 |
|
closed = true; |
119 |
|
out.close(); |
120 |
|
block = makeBlock(); |
121 |
|
} |
122 |
|
|
123 |
|
/** Create the block and add it to the pool. |
124 |
|
* When <code>close()</code> is called for the first time, |
125 |
|
* it calls this method internally. |
126 |
|
* @return The new block. |
127 |
|
*/ |
128 |
|
protected abstract Block makeBlock() throws IOException; |
129 |
|
|
130 |
public Block getBlock() { return block; } |
public Block getBlock() { return block; } |
131 |
public Header822 getHeader() { return header; } |
public Header822 getHeader() { return header; } |
132 |
} |
} |