public class FrameFileWriter extends Object implements Closeable
FrameFile. See that class for format information.| Modifier and Type | Field and Description |
|---|---|
static int |
CHECKSUM_SEED |
static byte[] |
MAGIC |
static byte |
MARKER_FRAME |
static byte |
MARKER_NO_MORE_FRAMES |
static int |
NO_PARTITION |
static int |
TRAILER_LENGTH |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Stops writing this file and closes early.
|
void |
close() |
static FrameFileWriter |
open(WritableByteChannel channel,
ByteBuffer compressionBuffer,
ByteTracker byteTracker)
Opens a writer for a particular channel.
|
void |
writeFrame(Frame frame,
int partition)
Write a frame.
|
public static final byte[] MAGIC
public static final byte MARKER_FRAME
public static final byte MARKER_NO_MORE_FRAMES
public static final int TRAILER_LENGTH
public static final int CHECKSUM_SEED
public static final int NO_PARTITION
public static FrameFileWriter open(WritableByteChannel channel, @Nullable ByteBuffer compressionBuffer, ByteTracker byteTracker)
channel - destination channelcompressionBuffer - result of Frame.compressionBufferSize(long) for the largest possible frame size that
will be written to this file, or null to allocate buffers dynamically.
Providing an explicit buffer here, if possible, improves performance.byteTracker - tracker to limit the number of bytes that can be written to the frame filepublic void writeFrame(Frame frame, int partition) throws IOException
frame - the framepartition - partition number for a partitioned frame file, or NO_PARTITION for an unpartitioned file.
Must be monotonically increasing.IOExceptionpublic void abort()
throws IOException
MARKER_NO_MORE_FRAMES.
After calling this method, close() does nothing.IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.