public class FileStateHandle extends Object implements StreamStateHandle
StreamStateHandle
for state that was written to a file stream. The written data is
identifier by the file path. The state can be read again by calling openInputStream()
.Constructor and Description |
---|
FileStateHandle(Path filePath,
long stateSize)
Creates a new file state for the given file path.
|
Modifier and Type | Method and Description |
---|---|
void |
discardState()
Discard the state by deleting the file that stores the state.
|
boolean |
equals(Object o) |
Path |
getFilePath()
Gets the path where this handle's state is stored.
|
long |
getStateSize()
Returns the file size in bytes.
|
int |
hashCode() |
FSDataInputStream |
openInputStream()
Returns an
FSDataInputStream that can be used to read back the data that
was previously written to the stream. |
String |
toString() |
public FileStateHandle(Path filePath, long stateSize)
filePath
- The path to the file that stores the state.public Path getFilePath()
public FSDataInputStream openInputStream() throws IOException
StreamStateHandle
FSDataInputStream
that can be used to read back the data that
was previously written to the stream.openInputStream
in interface StreamStateHandle
IOException
public void discardState() throws Exception
discardState
in interface StateObject
Exception
- Thrown, if the file deletion (not the directory deletion) fails.public long getStateSize()
getStateSize
in interface StateObject
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.