public static class SequenceFile.Writer extends Object implements Closeable
限定符和类型 | 字段和说明 |
---|---|
protected Serializer |
compressedValSerializer |
protected Serializer |
keySerializer |
protected Serializer |
uncompressedValSerializer |
构造器和说明 |
---|
SequenceFile.Writer(FileSystem fs,
Configuration conf,
Path name,
Class keyClass,
Class valClass)
Create the named file.
|
SequenceFile.Writer(FileSystem fs,
Configuration conf,
Path name,
Class keyClass,
Class valClass,
int bufferSize,
short replication,
long blockSize,
Progressable progress,
SequenceFile.Metadata metadata)
Create the named file with write-progress reporter.
|
SequenceFile.Writer(FileSystem fs,
Configuration conf,
Path name,
Class keyClass,
Class valClass,
Progressable progress,
SequenceFile.Metadata metadata)
Create the named file with write-progress reporter.
|
限定符和类型 | 方法和说明 |
---|---|
void |
append(Object key,
Object val)
Append a key/value pair.
|
void |
append(Writable key,
Writable val)
Append a key/value pair.
|
void |
appendRaw(byte[] keyData,
int keyOffset,
int keyLength,
SequenceFile.ValueBytes val) |
void |
close()
Close the file.
|
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
|
void |
syncFs()
flush all currently written data to the file system
|
protected Serializer keySerializer
protected Serializer uncompressedValSerializer
protected Serializer compressedValSerializer
public SequenceFile.Writer(FileSystem fs, Configuration conf, Path name, Class keyClass, Class valClass) throws IOException
IOException
public SequenceFile.Writer(FileSystem fs, Configuration conf, Path name, Class keyClass, Class valClass, Progressable progress, SequenceFile.Metadata metadata) throws IOException
IOException
public SequenceFile.Writer(FileSystem fs, Configuration conf, Path name, Class keyClass, Class valClass, int bufferSize, short replication, long blockSize, Progressable progress, SequenceFile.Metadata metadata) throws IOException
IOException
public Class getKeyClass()
public Class getValueClass()
public CompressionCodec getCompressionCodec()
public void sync() throws IOException
IOException
public void syncFs() throws IOException
IOException
public void close() throws IOException
close
在接口中 Closeable
close
在接口中 AutoCloseable
IOException
public void append(Writable key, Writable val) throws IOException
IOException
public void append(Object key, Object val) throws IOException
IOException
public void appendRaw(byte[] keyData, int keyOffset, int keyLength, SequenceFile.ValueBytes val) throws IOException
IOException
public long getLength() throws IOException
This always returns a synchronized position. In other words,
immediately after calling SequenceFile.Reader.seek(long)
with a position
returned by this method, SequenceFile.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 © 2009 The Apache Software Foundation