Package com.pspdfkit.document.providers
Class TempFileWritingStrategy
-
- All Implemented Interfaces:
-
com.pspdfkit.document.providers.WritingStrategy
public final class TempFileWritingStrategy implements WritingStrategy
A WritingStrategy that writes to a temporary file and writes to the [ ] only when all data was written.
Creates a new TempFileWritingStrategy.
-
-
Constructor Summary
Constructors Constructor Description TempFileWritingStrategy(Context context)
Creates a new TempFileWritingStrategy. TempFileWritingStrategy(File tempFile)
-
Method Summary
Modifier and Type Method Description Unit
prepare(OutputStreamAdapter adapter)
Called by the OutputStreamAdapter before the first byte is written. Unit
write(ByteArray data)
Called by the OutputStreamAdapter with the data that should be written. Unit
finishWriting()
Called by the OutputStreamAdapter once the last byte was written. -
-
Constructor Detail
-
TempFileWritingStrategy
TempFileWritingStrategy(Context context)
Creates a new TempFileWritingStrategy.- Parameters:
context
- Context to use to obtain the cache directory for creating a temporary file.
-
TempFileWritingStrategy
TempFileWritingStrategy(File tempFile)
- Parameters:
tempFile
- The file to write to, this will be deleted once the write operation is done.
-
-
Method Detail
-
prepare
Unit prepare(OutputStreamAdapter adapter)
Called by the OutputStreamAdapter before the first byte is written.
- Parameters:
adapter
- The OutputStreamAdapter using this WritingStrategy.
-
write
Unit write(ByteArray data)
Called by the OutputStreamAdapter with the data that should be written.
- Parameters:
data
- The data that should be written.
-
finishWriting
Unit finishWriting()
Called by the OutputStreamAdapter once the last byte was written. You should clear your reference to the OutputStreamAdapter at this time.
-
-
-
-