org.apache.accumulo.core.file.map
Class MySequenceFile.Writer

java.lang.Object
  extended by org.apache.accumulo.core.file.map.MySequenceFile.Writer
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
MySequenceFile

public static class MySequenceFile.Writer
extends java.lang.Object
implements java.io.Closeable

Write key/value pairs to a sequence-format file.


Field Summary
protected  org.apache.hadoop.io.serializer.Serializer compressedValSerializer
           
protected  org.apache.hadoop.io.serializer.Serializer keySerializer
           
protected  org.apache.hadoop.io.serializer.Serializer uncompressedValSerializer
           
 
Constructor Summary
MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, java.lang.Class keyClass, java.lang.Class valClass)
          Create the named file.
MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, java.lang.Class keyClass, java.lang.Class valClass, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress, MySequenceFile.Metadata metadata)
          Create the named file with write-progress reporter.
MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, java.lang.Class keyClass, java.lang.Class valClass, org.apache.hadoop.util.Progressable progress, MySequenceFile.Metadata metadata)
          Create the named file with write-progress reporter.
 
Method Summary
 void append(java.lang.Object key, java.lang.Object val)
          Append a key/value pair.
 void append(org.apache.hadoop.io.Writable key, org.apache.hadoop.io.Writable val)
          Append a key/value pair.
 void appendRaw(byte[] keyData, int keyOffset, int keyLength, MySequenceFile.ValueBytes val)
           
 void close()
          Close the file.
 org.apache.hadoop.io.compress.CompressionCodec getCompressionCodec()
          Returns the compression codec of data in this file.
 java.lang.Class getKeyClass()
          Returns the class of keys in this file.
 long getLength()
          Returns the current length of the output file.
 java.lang.Class getValueClass()
          Returns the class of values in this file.
 void sync()
          create a sync point
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keySerializer

protected org.apache.hadoop.io.serializer.Serializer keySerializer

uncompressedValSerializer

protected org.apache.hadoop.io.serializer.Serializer uncompressedValSerializer

compressedValSerializer

protected org.apache.hadoop.io.serializer.Serializer compressedValSerializer
Constructor Detail

MySequenceFile.Writer

public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs,
                             org.apache.hadoop.conf.Configuration conf,
                             org.apache.hadoop.fs.Path name,
                             java.lang.Class keyClass,
                             java.lang.Class valClass)
                      throws java.io.IOException
Create the named file.

Throws:
java.io.IOException

MySequenceFile.Writer

public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs,
                             org.apache.hadoop.conf.Configuration conf,
                             org.apache.hadoop.fs.Path name,
                             java.lang.Class keyClass,
                             java.lang.Class valClass,
                             org.apache.hadoop.util.Progressable progress,
                             MySequenceFile.Metadata metadata)
                      throws java.io.IOException
Create the named file with write-progress reporter.

Throws:
java.io.IOException

MySequenceFile.Writer

public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs,
                             org.apache.hadoop.conf.Configuration conf,
                             org.apache.hadoop.fs.Path name,
                             java.lang.Class keyClass,
                             java.lang.Class valClass,
                             int bufferSize,
                             short replication,
                             long blockSize,
                             org.apache.hadoop.util.Progressable progress,
                             MySequenceFile.Metadata metadata)
                      throws java.io.IOException
Create the named file with write-progress reporter.

Throws:
java.io.IOException
Method Detail

getKeyClass

public java.lang.Class getKeyClass()
Returns the class of keys in this file.


getValueClass

public java.lang.Class getValueClass()
Returns the class of values in this file.


getCompressionCodec

public org.apache.hadoop.io.compress.CompressionCodec getCompressionCodec()
Returns the compression codec of data in this file.


sync

public void sync()
          throws java.io.IOException
create a sync point

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Close the file.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

append

public void append(org.apache.hadoop.io.Writable key,
                   org.apache.hadoop.io.Writable val)
            throws java.io.IOException
Append a key/value pair.

Throws:
java.io.IOException

append

public void append(java.lang.Object key,
                   java.lang.Object val)
            throws java.io.IOException
Append a key/value pair.

Throws:
java.io.IOException

appendRaw

public void appendRaw(byte[] keyData,
                      int keyOffset,
                      int keyLength,
                      MySequenceFile.ValueBytes val)
               throws java.io.IOException
Throws:
java.io.IOException

getLength

public long getLength()
               throws java.io.IOException
Returns the current length of the output file.

This always returns a synchronized position. In other words, immediately after calling MySequenceFile.Reader.seek(long) with a position returned by this method, MySequenceFile.Reader.next(Writable) may be called. However the key may be earlier in the file than key last written when this method was called (e.g., with block-compression, it may be the first key in the block that was being written when this method was called).

Throws:
java.io.IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.