java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, StreamCapabilities, Syncablepublic static class SequenceFile.Writer extends java.lang.Object implements java.io.Closeable, Syncable, java.io.Flushable, StreamCapabilities
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
SequenceFile.Writer.Option |
StreamCapabilities.StreamCapability| Modifier and Type | Field | Description |
|---|---|---|
protected Serializer |
compressedValSerializer |
|
protected Serializer |
keySerializer |
|
protected Serializer |
uncompressedValSerializer |
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO| Constructor | Description |
|---|---|
Writer(FileSystem fs,
Configuration conf,
Path name,
java.lang.Class keyClass,
java.lang.Class valClass) |
Deprecated.
|
Writer(FileSystem fs,
Configuration conf,
Path name,
java.lang.Class keyClass,
java.lang.Class valClass,
int bufferSize,
short replication,
long blockSize,
Progressable progress,
SequenceFile.Metadata metadata) |
Deprecated.
|
Writer(FileSystem fs,
Configuration conf,
Path name,
java.lang.Class keyClass,
java.lang.Class valClass,
Progressable progress,
SequenceFile.Metadata metadata) |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
append(java.lang.Object key,
java.lang.Object val) |
Append a key/value pair.
|
void |
append(Writable key,
Writable val) |
Append a key/value pair.
|
static SequenceFile.Writer.Option |
appendIfExists(boolean value) |
|
void |
appendRaw(byte[] keyData,
int keyOffset,
int keyLength,
SequenceFile.ValueBytes val) |
|
static SequenceFile.Writer.Option |
blockSize(long value) |
|
static SequenceFile.Writer.Option |
bufferSize(int value) |
|
void |
close() |
Close the file.
|
static SequenceFile.Writer.Option |
compression(SequenceFile.CompressionType value) |
|
static SequenceFile.Writer.Option |
compression(SequenceFile.CompressionType value,
CompressionCodec codec) |
|
static SequenceFile.Writer.Option |
file(Path value) |
|
void |
flush() |
|
CompressionCodec |
getCompressionCodec() |
|
java.lang.Class |
getKeyClass() |
|
long |
getLength() |
|
java.lang.Class |
getValueClass() |
|
boolean |
hasCapability(java.lang.String capability) |
Query the stream for a specific capability.
|
void |
hflush() |
Flush out the data in client's user buffer.
|
void |
hsync() |
Similar to posix fsync, flush out the data in client's user buffer
all the way to the disk device (but the disk may have it in its cache).
|
static SequenceFile.Writer.Option |
keyClass(java.lang.Class<?> value) |
|
static SequenceFile.Writer.Option |
metadata(SequenceFile.Metadata value) |
|
static SequenceFile.Writer.Option |
progressable(Progressable value) |
|
static SequenceFile.Writer.Option |
replication(short value) |
|
static SequenceFile.Writer.Option |
stream(FSDataOutputStream value) |
|
void |
sync() |
|
void |
syncFs() |
|
static SequenceFile.Writer.Option |
syncInterval(int value) |
|
static SequenceFile.Writer.Option |
valueClass(java.lang.Class<?> value) |
protected Serializer keySerializer
protected Serializer uncompressedValSerializer
protected Serializer compressedValSerializer
@Deprecated public Writer(FileSystem fs, Configuration conf, Path name, java.lang.Class keyClass, java.lang.Class valClass) throws java.io.IOException
fs - input filesystem.conf - input configuration.name - input name.keyClass - input keyClass.valClass - input valClass.java.io.IOException - raised on errors performing I/O.@Deprecated public Writer(FileSystem fs, Configuration conf, Path name, java.lang.Class keyClass, java.lang.Class valClass, Progressable progress, SequenceFile.Metadata metadata) throws java.io.IOException
fs - input filesystem.conf - input configuration.name - input name.keyClass - input keyClass.valClass - input valClass.progress - input progress.metadata - input metadata.java.io.IOException - raised on errors performing I/O.@Deprecated public Writer(FileSystem fs, Configuration conf, Path name, java.lang.Class keyClass, java.lang.Class valClass, int bufferSize, short replication, long blockSize, Progressable progress, SequenceFile.Metadata metadata) throws java.io.IOException
fs - input filesystem.conf - input configuration.name - input name.keyClass - input keyClass.valClass - input valClass.bufferSize - input bufferSize.replication - input replication.blockSize - input blockSize.progress - input progress.metadata - input metadata.java.io.IOException - raised on errors performing I/O.public static SequenceFile.Writer.Option file(Path value)
public static SequenceFile.Writer.Option bufferSize(int value)
public static SequenceFile.Writer.Option stream(FSDataOutputStream value)
public static SequenceFile.Writer.Option replication(short value)
public static SequenceFile.Writer.Option appendIfExists(boolean value)
public static SequenceFile.Writer.Option blockSize(long value)
public static SequenceFile.Writer.Option progressable(Progressable value)
public static SequenceFile.Writer.Option keyClass(java.lang.Class<?> value)
public static SequenceFile.Writer.Option valueClass(java.lang.Class<?> value)
public static SequenceFile.Writer.Option metadata(SequenceFile.Metadata value)
public static SequenceFile.Writer.Option compression(SequenceFile.CompressionType value)
public static SequenceFile.Writer.Option compression(SequenceFile.CompressionType value, CompressionCodec codec)
public static SequenceFile.Writer.Option syncInterval(int value)
public java.lang.Class getKeyClass()
public java.lang.Class getValueClass()
public CompressionCodec getCompressionCodec()
public void sync()
throws java.io.IOException
sync in interface Syncablejava.io.IOExceptionSyncable.hflush()@Deprecated
public void syncFs()
throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public void hsync()
throws java.io.IOException
Syncablepublic void hflush()
throws java.io.IOException
Syncablepublic void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOExceptionpublic boolean hasCapability(java.lang.String capability)
StreamCapabilitieshasCapability in interface StreamCapabilitiescapability - string to query the stream support for.public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionpublic void append(Writable key, Writable val) throws java.io.IOException
key - input Writable key.val - input Writable val.java.io.IOException - raised on errors performing I/O.public void append(java.lang.Object key,
java.lang.Object val)
throws java.io.IOException
key - input Object key.val - input Object val.java.io.IOException - raised on errors performing I/O.public void appendRaw(byte[] keyData,
int keyOffset,
int keyLength,
SequenceFile.ValueBytes val)
throws java.io.IOException
java.io.IOExceptionpublic long getLength()
throws java.io.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).
java.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.