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