org.apache.cassandra.io
Interface IFileWriter

All Known Implementing Classes:
SequenceFile.AbstractWriter, SequenceFile.BufferWriter, SequenceFile.ChecksumWriter, SequenceFile.ConcurrentWriter, SequenceFile.FastConcurrentWriter, SequenceFile.Writer

public interface IFileWriter

An interface for writing into the SequenceFile abstraction. Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )


Method Summary
 void append(DataOutputBuffer buffer)
          Appends the buffer to the the underlying SequenceFile.
 void append(DataOutputBuffer keyBuffer, DataOutputBuffer buffer)
          Appends the key and the value to the the underlying SequenceFile.
 void append(java.lang.String key, byte[] value)
          Appends the key and the value to the the underlying SequenceFile.
 void append(java.lang.String key, DataOutputBuffer buffer)
          Appends the key and the value to the the underlying SequenceFile.
 void append(java.lang.String key, long value)
          Appends the key and the long value to the the underlying SequenceFile.
 void close()
          Close the file which is being used for the write.
 void close(byte[] footer, int size)
          Close the file after appending the passed in footer information.
 long getCurrentPosition()
          Get the current position of the file pointer.
 java.lang.String getFileName()
           
 long getFileSize()
           
 long lastModified()
           
 void seek(long position)
          Seeks the file pointer to the specified position.
 long writeDirect(byte[] bytes)
          Be extremely careful while using this API.
 void writeLong(long value)
          Write a long into the underlying sub system.
 

Method Detail

getCurrentPosition

long getCurrentPosition()
                        throws java.io.IOException
Get the current position of the file pointer.

Returns:
current file pointer position
Throws:
java.io.IOException

lastModified

long lastModified()
Returns:
the last file modification time.

seek

void seek(long position)
          throws java.io.IOException
Seeks the file pointer to the specified position.

Parameters:
position - position within the file to seek to.
Throws:
java.io.IOException

append

void append(DataOutputBuffer buffer)
            throws java.io.IOException
Appends the buffer to the the underlying SequenceFile.

Parameters:
buffer - buffer which contains the serialized data.
Throws:
java.io.IOException

append

void append(DataOutputBuffer keyBuffer,
            DataOutputBuffer buffer)
            throws java.io.IOException
Appends the key and the value to the the underlying SequenceFile.

Parameters:
keyBuffer - buffer which contains the serialized key.
buffer - buffer which contains the serialized data.
Throws:
java.io.IOException

append

void append(java.lang.String key,
            DataOutputBuffer buffer)
            throws java.io.IOException
Appends the key and the value to the the underlying SequenceFile.

Parameters:
key - key associated with this peice of data.
buffer - buffer containing the serialized data.
Throws:
java.io.IOException

append

void append(java.lang.String key,
            byte[] value)
            throws java.io.IOException
Appends the key and the value to the the underlying SequenceFile.

Parameters:
key - key associated with this peice of data.
value - byte array containing the serialized data.
Throws:
java.io.IOException

append

void append(java.lang.String key,
            long value)
            throws java.io.IOException
Appends the key and the long value to the the underlying SequenceFile. This is used in the contruction of the index file associated with a SSTable.

Parameters:
key - key associated with this peice of data.
value - value associated with this key.
Throws:
java.io.IOException

writeDirect

long writeDirect(byte[] bytes)
                 throws java.io.IOException
Be extremely careful while using this API. This currently used to write the commit log header in the commit logs. If not used carefully it could completely screw up reads of other key/value pairs that are written.

Parameters:
bytes - serialized version of the commit log header.
Throws:
java.io.IOException

writeLong

void writeLong(long value)
               throws java.io.IOException
Write a long into the underlying sub system.

Parameters:
value - long to be written
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Close the file which is being used for the write.

Throws:
java.io.IOException

close

void close(byte[] footer,
           int size)
           throws java.io.IOException
Close the file after appending the passed in footer information.

Parameters:
footer - footer information.
size - size of the footer.
Throws:
java.io.IOException

getFileName

java.lang.String getFileName()
Returns:
the name of the file.

getFileSize

long getFileSize()
                 throws java.io.IOException
Returns:
the size of the file.
Throws:
java.io.IOException


Copyright © 2009 The Apache Software Foundation