public class SnapStream extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SnapStream.StreamMode |
Modifier and Type | Field and Description |
---|---|
static String |
ZOOKEEPER_SHAPSHOT_STREAM_MODE |
Constructor and Description |
---|
SnapStream() |
Modifier and Type | Method and Description |
---|---|
static CheckedInputStream |
getInputStream(File file)
Return the CheckedInputStream based on the extension of the fileName.
|
static CheckedOutputStream |
getOutputStream(File file,
boolean fsync)
Return the OutputStream based on predefined stream mode.
|
static SnapStream.StreamMode |
getStreamMode() |
static SnapStream.StreamMode |
getStreamMode(String fileName)
Detect the stream mode from file name extension
|
static boolean |
isValidSnapshot(File file)
Verifies that the file is a valid snapshot.
|
static void |
sealStream(CheckedOutputStream os,
OutputArchive oa)
Write specific seal to the OutputArchive and close the OutputStream.
|
static void |
setStreamMode(SnapStream.StreamMode mode) |
public static final String ZOOKEEPER_SHAPSHOT_STREAM_MODE
public static CheckedInputStream getInputStream(File file) throws IOException
file
- the file the InputStream read fromIOException
public static CheckedOutputStream getOutputStream(File file, boolean fsync) throws IOException
file
- the file the OutputStream writes tofsync
- sync the file immediately after writeIOException
public static void sealStream(CheckedOutputStream os, OutputArchive oa) throws IOException
IOException
public static boolean isValidSnapshot(File file) throws IOException
file
- file to verifyIOException
public static void setStreamMode(SnapStream.StreamMode mode)
public static SnapStream.StreamMode getStreamMode()
public static SnapStream.StreamMode getStreamMode(String fileName)
fileName
- Copyright © 2008–2023 The Apache Software Foundation. All rights reserved.