public class DataTempFileSwap extends Object implements DataSwap
A DataSwap
implementation which uses temporary files for storing the
data.
File.createTempFile(String, String)
Constructor and Description |
---|
DataTempFileSwap(String name)
Creates a swap.
|
DataTempFileSwap(String name,
String prefix,
String suffix)
Creates a swap.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
DataSource |
getSource()
Returns the source.
|
DataTarget |
getTarget()
Returns the target.
|
public DataTempFileSwap(String name)
Creates a swap.
name
- The name of the target and source.IllegalArgumentException
- If the name is null
.public DataTempFileSwap(String name, String prefix, String suffix)
Creates a swap.
name
- The name of the target and source.prefix
- The prefix of the filename.suffix
- The suffix of the filename.IllegalArgumentException
- If any of the parameters are null
.public DataTarget getTarget() throws IOException
DataSwap
Returns the target.
Subsequent calls will return the same target.
getTarget
in interface DataSwap
IOException
- If an I/O error occurs while creating the target.public DataSource getSource() throws IOException
DataSwap
Returns the source.
Subsequent calls will return the same source.
getSource
in interface DataSwap
IOException
- If an I/O error occurs while creating the source.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2015–2019. All rights reserved.