Package com.helger.as2lib.util.http
Class TempSharedFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.BufferedInputStream
-
- jakarta.mail.util.SharedFileInputStream
-
- com.helger.as2lib.util.http.TempSharedFileInputStream
-
- All Implemented Interfaces:
jakarta.mail.internet.SharedInputStream,Closeable,AutoCloseable
public class TempSharedFileInputStream extends jakarta.mail.util.SharedFileInputStreamStores the content of the inputInputStreamin a temporary file, and opensSharedFileInputStreamon that file. When the stream is closed, the file will be deleted, and the input stream will be closed.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()close - Do nothing, to prevent early close, as the cryptographic processing stages closes their input streamvoidcloseAll()Deprecated.Since 4.10.2.voidcloseAndDelete()closeAll - closes the input stream, and deletes the backing fileprotected voidfinalize()finalize - closes also the input stream, and deletes the backing filestatic TempSharedFileInputStreamgetTempSharedFileInputStream(InputStream aIS, String sName)Stores the content of the inputInputStreamin a temporary file (in the system temporary directory, and opensSharedFileInputStreamon that file.protected static FilestoreContentToTempFile(InputStream aIS, String sName)Stores the content of the inputInputStreamin a temporary file (in the system temporary directory.-
Methods inherited from class jakarta.mail.util.SharedFileInputStream
available, getPosition, mark, markSupported, newStream, read, read, reset, skip
-
Methods inherited from class java.io.FilterInputStream
read
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Method Detail
-
close
public void close() throws IOExceptionclose - Do nothing, to prevent early close, as the cryptographic processing stages closes their input stream- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classjakarta.mail.util.SharedFileInputStream- Throws:
IOException
-
finalize
protected void finalize() throws Throwablefinalize - closes also the input stream, and deletes the backing file- Overrides:
finalizein classjakarta.mail.util.SharedFileInputStream- Throws:
Throwable
-
closeAll
@Deprecated public void closeAll() throws IOException
Deprecated.Since 4.10.2. UsecloseAndDelete()insteadcloseAll - closes the input stream, and deletes the backing file- Throws:
IOException- in case of error
-
closeAndDelete
public void closeAndDelete() throws IOExceptioncloseAll - closes the input stream, and deletes the backing file- Throws:
IOException- in case of error- Since:
- 4.10.2
-
storeContentToTempFile
@Nonnull protected static File storeContentToTempFile(@Nonnull @WillClose InputStream aIS, @Nonnull String sName) throws IOException
Stores the content of the inputInputStreamin a temporary file (in the system temporary directory.- Parameters:
aIS-InputStreamto read fromsName- name to use in the temporary file to link it to the delivered message. May be null- Returns:
- The created
File - Throws:
IOException- in case of IO error
-
getTempSharedFileInputStream
@Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream(@Nonnull @WillClose InputStream aIS, @Nonnull String sName) throws IOException
Stores the content of the inputInputStreamin a temporary file (in the system temporary directory, and opensSharedFileInputStreamon that file.- Parameters:
aIS-InputStreamto read fromsName- name to use in the temporary file to link it to the delivered message. May be null- Returns:
TempSharedFileInputStreamon the created temporary file.- Throws:
IOException- in case of IO error
-
-