|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.labs.minion.indexer.postings.io.ChannelPostingsOutput
public class ChannelPostingsOutput
An implementation of PostingsOutput
that buffers the
postings, eventually writing them to a channel.
Field Summary | |
---|---|
protected java.nio.ByteBuffer |
buff
A buffer. |
protected java.nio.channels.FileChannel |
chan
The channel. |
protected static int |
DEFAULT_SIZE
The default buffer size, 64K. |
Constructor Summary | |
---|---|
ChannelPostingsOutput(java.nio.channels.FileChannel chan)
Creates a postings output channel that will write to the given channel. |
|
ChannelPostingsOutput(java.nio.channels.FileChannel chan,
int buffSize)
Creates a postings output channel that will write to the given channel, buffering the given amount. |
Method Summary | |
---|---|
void |
flush()
Flushes the buffer to the channel. |
long |
position()
Gets the position of the the channel. |
int |
write(WriteableBuffer b)
Writes a set of postings to the channel (possibly buffering them). |
long |
write(WriteableBuffer[] b)
Writes a set of postings encoded onto a buffer to the channel (possibly buffering them). |
long |
write(WriteableBuffer[] b,
int offset,
int length)
Writes a subsequence of a set of postings encoded onto a buffer to the channel (possibly buffering them). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.nio.ByteBuffer buff
protected java.nio.channels.FileChannel chan
protected static final int DEFAULT_SIZE
Constructor Detail |
---|
public ChannelPostingsOutput(java.nio.channels.FileChannel chan)
chan
- The channel to write data to.public ChannelPostingsOutput(java.nio.channels.FileChannel chan, int buffSize)
chan
- The channel to write data to.buffSize
- The size of the buffer to use for writing postings.Method Detail |
---|
public int write(WriteableBuffer b) throws java.io.IOException
write
in interface PostingsOutput
b
- The buffer to write.
java.io.IOException
- If there is any error writing the postings.public long write(WriteableBuffer[] b) throws java.io.IOException
write
in interface PostingsOutput
b
- The buffers to write.
java.io.IOException
- If there is any error writing the postings.public long write(WriteableBuffer[] b, int offset, int length) throws java.io.IOException
write
in interface PostingsOutput
b
- The buffers to write.offset
- The offset in b
where we will begin
writing bytes.length
- The length of the subsequence of b
for
which we will write postings.
java.io.IOException
- If there is any error writing to the channel.public long position() throws java.io.IOException
position
in interface PostingsOutput
java.io.IOException
- If there is any error getting the position.public void flush() throws java.io.IOException
flush
in interface PostingsOutput
java.io.IOException
- If there is any error writing data to the channel.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |