org.apache.cassandra.io
Class SequenceFile

java.lang.Object
  extended by org.apache.cassandra.io.SequenceFile

public class SequenceFile
extends java.lang.Object

This class writes key/value pairs seqeuntially to disk. It is also used to read sequentially from disk. However one could jump to random positions to read data from the file. This class also has many implementations of the IFileWriter and IFileReader interfaces which are exposed through factory methods.

Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) & Karthik Ranganathan ( kranganathan@facebook.com )


Nested Class Summary
static class SequenceFile.AbstractReader
           
static class SequenceFile.AbstractWriter
           
static class SequenceFile.BufferReader
           
static class SequenceFile.BufferWriter
           
static class SequenceFile.ChecksumReader
           
static class SequenceFile.ChecksumWriter
           
static class SequenceFile.ConcurrentWriter
           
static class SequenceFile.FastConcurrentWriter
           
static class SequenceFile.Reader
           
static class SequenceFile.Writer
           
 
Field Summary
static java.lang.String marker_
           
static short utfPrefix_
           
 
Constructor Summary
SequenceFile()
           
 
Method Summary
static IFileReader bufferedReader(java.lang.String filename, int size)
           
static IFileWriter bufferedWriter(java.lang.String filename, int size)
           
static IFileWriter fastWriter(java.lang.String filename, int size)
           
static IFileReader reader(java.lang.String filename)
           
static IFileWriter writer(java.lang.String filename)
           
protected static void writeUTF(java.nio.ByteBuffer buffer, java.lang.String str)
          Efficiently writes a UTF8 string to the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

utfPrefix_

public static final short utfPrefix_
See Also:
Constant Field Values

marker_

public static final java.lang.String marker_
See Also:
Constant Field Values
Constructor Detail

SequenceFile

public SequenceFile()
Method Detail

writer

public static IFileWriter writer(java.lang.String filename)
                          throws java.io.IOException
Throws:
java.io.IOException

bufferedWriter

public static IFileWriter bufferedWriter(java.lang.String filename,
                                         int size)
                                  throws java.io.IOException
Throws:
java.io.IOException

fastWriter

public static IFileWriter fastWriter(java.lang.String filename,
                                     int size)
                              throws java.io.IOException
Throws:
java.io.IOException

reader

public static IFileReader reader(java.lang.String filename)
                          throws java.io.IOException
Throws:
java.io.IOException

bufferedReader

public static IFileReader bufferedReader(java.lang.String filename,
                                         int size)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeUTF

protected static void writeUTF(java.nio.ByteBuffer buffer,
                               java.lang.String str)
Efficiently writes a UTF8 string to the buffer. Assuming all Strings that are passed in have length that can be represented as a short i.e length of the string is <= 65535

Parameters:
buffer - buffer to write the serialize version into
str - string to serialize


Copyright © 2009 The Apache Software Foundation