public static class MySequenceFile.Writer extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path name,
Class keyClass,
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,
Class keyClass,
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,
Class keyClass,
Class valClass,
org.apache.hadoop.util.Progressable progress,
MySequenceFile.Metadata metadata)
Create the named file with write-progress reporter.
|
Modifier and Type | Method and Description |
---|---|
void |
append(Object key,
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.
|
Class |
getKeyClass()
Returns the class of keys in this file.
|
long |
getLength()
Returns the current length of the output file.
|
Class |
getValueClass()
Returns the class of values in this file.
|
void |
sync()
create a sync point
|
protected org.apache.hadoop.io.serializer.Serializer keySerializer
protected org.apache.hadoop.io.serializer.Serializer uncompressedValSerializer
protected org.apache.hadoop.io.serializer.Serializer compressedValSerializer
public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, Class keyClass, Class valClass) throws IOException
IOException
public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, Class keyClass, Class valClass, org.apache.hadoop.util.Progressable progress, MySequenceFile.Metadata metadata) throws IOException
IOException
public MySequenceFile.Writer(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path name, Class keyClass, Class valClass, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress, MySequenceFile.Metadata metadata) throws IOException
IOException
public Class getKeyClass()
public Class getValueClass()
public org.apache.hadoop.io.compress.CompressionCodec getCompressionCodec()
public void sync() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void append(org.apache.hadoop.io.Writable key, org.apache.hadoop.io.Writable val) throws IOException
IOException
public void append(Object key, Object val) throws IOException
IOException
public void appendRaw(byte[] keyData, int keyOffset, int keyLength, MySequenceFile.ValueBytes val) throws IOException
IOException
public long getLength() throws IOException
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).
IOException
Copyright © 2012 The Apache Software Foundation. All Rights Reserved.