Package org.apache.iceberg.inmemory
Class InMemoryOutputFile
- java.lang.Object
-
- org.apache.iceberg.inmemory.InMemoryOutputFile
-
- All Implemented Interfaces:
OutputFile
public class InMemoryOutputFile extends java.lang.Object implements OutputFile
-
-
Constructor Summary
Constructors Constructor Description InMemoryOutputFile()
InMemoryOutputFile(java.lang.String location)
InMemoryOutputFile(java.lang.String location, InMemoryFileIO parentFileIO)
If the optional parentFileIO is provided, file-existence behaves similarly to S3FileIO; existence checks are performed up-front if creating without overwrite, but files only exist in the parentFileIO if close() has been called on the associated output streams (or pre-existing files are populated into the parentFileIO through other means).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PositionOutputStream
create()
Create a new file and return aPositionOutputStream
to it.PositionOutputStream
createOrOverwrite()
Create a new file and return aPositionOutputStream
to it.java.lang.String
location()
Return the location this output file will create.byte[]
toByteArray()
InputFile
toInputFile()
Return anInputFile
for the location of this output file.
-
-
-
Constructor Detail
-
InMemoryOutputFile
public InMemoryOutputFile()
-
InMemoryOutputFile
public InMemoryOutputFile(java.lang.String location)
-
InMemoryOutputFile
public InMemoryOutputFile(java.lang.String location, InMemoryFileIO parentFileIO)
If the optional parentFileIO is provided, file-existence behaves similarly to S3FileIO; existence checks are performed up-front if creating without overwrite, but files only exist in the parentFileIO if close() has been called on the associated output streams (or pre-existing files are populated into the parentFileIO through other means).- Parameters:
location
- the location returned by location() of this OutputFile, the InputFile obtained from calling toInputFile(), and the location for looking up the associated InputFile from a parentFileIO, if non-null.parentFileIO
- if non-null, commits an associated InMemoryInputFile on close() into the parentFileIO, and uses the parentFileIO for "already exists" checks if creating without overwriting.
-
-
Method Detail
-
create
public PositionOutputStream create()
Description copied from interface:OutputFile
Create a new file and return aPositionOutputStream
to it.If the file already exists, this will throw an exception.
- Specified by:
create
in interfaceOutputFile
- Returns:
- an output stream that can report its position
-
createOrOverwrite
public PositionOutputStream createOrOverwrite()
Description copied from interface:OutputFile
Create a new file and return aPositionOutputStream
to it.If the file already exists, this will not throw an exception and will replace the file.
- Specified by:
createOrOverwrite
in interfaceOutputFile
- Returns:
- an output stream that can report its position
-
location
public java.lang.String location()
Description copied from interface:OutputFile
Return the location this output file will create.- Specified by:
location
in interfaceOutputFile
- Returns:
- the location of this output file
-
toInputFile
public InputFile toInputFile()
Description copied from interface:OutputFile
Return anInputFile
for the location of this output file.- Specified by:
toInputFile
in interfaceOutputFile
- Returns:
- an input file for the location of this output file
-
toByteArray
public byte[] toByteArray()
-
-