public class AS2ResourceHelper extends Object implements Closeable
createTempFile() a new filename is created and added to the list.
When using addCloseable(Closeable) the Closable is added for
postponed closing.| Constructor and Description |
|---|
AS2ResourceHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseable(Closeable aCloseable)
Add a new closable for later closing.
|
void |
close() |
org.apache.hc.core5.http.HttpEntity |
createRepeatableHttpEntity(org.apache.hc.core5.http.HttpEntity aSrcEntity)
Ensure the provided
HttpEntity can be read more than once. |
File |
createTempFile() |
com.helger.commons.collection.impl.ICommonsList<Closeable> |
getAllCloseables() |
com.helger.commons.collection.impl.ICommonsList<File> |
getAllTempFiles() |
static File |
getTempDir() |
static void |
setTempDir(File aTempDir)
Set a temporary directory to use.
|
@Nullable public static File getTempDir()
null for the system
default.public static void setTempDir(@Nullable File aTempDir)
aTempDir - The directory to use. It must be an existing directory. May be
null to use the system default.IllegalArgumentException - If the directory does not exist@Nonnull public File createTempFile() throws IOException
File that will be deleted when
close() is called.IOException - When temp file creation fails.IllegalStateException - If close() was already called before@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<File> getAllTempFiles()
null but maybe
empty.public void addCloseable(@Nonnull Closeable aCloseable)
aCloseable - The closable to be closed later. May not be null.IllegalStateException - If close() was already called before@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<Closeable> getAllCloseables()
null but maybe
empty.public void close()
close in interface Closeableclose in interface AutoCloseable@Nonnull public org.apache.hc.core5.http.HttpEntity createRepeatableHttpEntity(@Nonnull org.apache.hc.core5.http.HttpEntity aSrcEntity) throws IOException
HttpEntity can be read more than once. If the
provided entity is not repeatable a temporary file is created and a new
file-based Http Entity is created.aSrcEntity - The source Http entity. May not be null.null Http entity that can be read more than
once.IOException - on IO errorCopyright © 2013–2022 Philip Helger. All rights reserved.