public class

TempFileWritingStrategy

extends Object
implements WritingStrategy
java.lang.Object
   ↳ com.pspdfkit.document.providers.TempFileWritingStrategy

Class Overview

A WritingStrategy that writes to a temporary file and writes to the WritableDataProvider only when all data was written.

Summary

Public Constructors
TempFileWritingStrategy(File tempFile)
TempFileWritingStrategy(Context context)
Public Methods
void finishWriting()
Called by the OutputStreamAdapter once the last byte was written.
void prepare(OutputStreamAdapter adapter)
Called by the OutputStreamAdapter before the first byte is written.
void write(byte[] data)
Called by the OutputStreamAdapter with the data that should be written.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pspdfkit.document.providers.WritingStrategy

Public Constructors

public TempFileWritingStrategy (File tempFile)

Parameters
tempFile The file to write to, this will be deleted once the write operation is done.

public TempFileWritingStrategy (Context context)

Parameters
context Context to use to obtain the cache directory for creating a temporary file.
Throws
IOException

Public Methods

public void finishWriting ()

Called by the OutputStreamAdapter once the last byte was written. You should clear your reference to the OutputStreamAdapter at this time.

Throws
IOException

public void prepare (OutputStreamAdapter adapter)

Called by the OutputStreamAdapter before the first byte is written.

Parameters
adapter The OutputStreamAdapter using this WritingStrategy.

public void write (byte[] data)

Called by the OutputStreamAdapter with the data that should be written.

Parameters
data The data that should be written.
Throws
IOException