com.microsoft.tfs.core.clients.versioncontrol.specs
Interface DownloadOutput


public interface DownloadOutput

Used by VersionControlClient's download methods to support writing to multiple output streams simultaneously. Each output can have its own content type preference (auto gunzip or not).

Callers can see which content type was actually written to the output stream by calling getActualContentType().

Since:
TEE-SDK-11.0
Thread-safety:
thread-safe

Method Summary
 void closeOutputStream()
          Called to close the OutputStream if it was open.
 java.lang.String getActualContentType()
           
 java.io.OutputStream getOutputStream()
          Gets the OutputStream to write bytes to.
 boolean isAutoGunzip()
           
 void resetOutputStream()
          Called by the download process if a transient download error happened and the download will be retried with a new output stream.
 void setActualContentType(java.lang.String type)
          Sets the content type of the data that was actually written to the output stream during the download.
 

Method Detail

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Gets the OutputStream to write bytes to. See the notes on resetOutputStream() on recreating a stream after a transient download failure.

Returns:
the OutputStream this class was constructed with (never null)
Throws:
java.io.IOException

resetOutputStream

void resetOutputStream()
                       throws java.io.IOException
Called by the download process if a transient download error happened and the download will be retried with a new output stream. getOutputStream() will be called after this method to obtain the output stream to retry the download with. If an implementation returns the same stream after resetOutputStream() is called, it should rewind or reset the stream to accept the first bytes of the download again.

Implementations are not required to implement this method and may throw an IOException if they choose not to.

Throws:
java.io.IOException

closeOutputStream

void closeOutputStream()
                       throws java.io.IOException
Called to close the OutputStream if it was open. Safe to call again on an already-closed output.

Throws:
java.io.IOException

isAutoGunzip

boolean isAutoGunzip()
Returns:
true if the download process should gunzip the bytes before writing them to the output stream; false if the download process should write unprocessed bytes

setActualContentType

void setActualContentType(java.lang.String type)
Sets the content type of the data that was actually written to the output stream during the download.

Parameters:
type - the type that was written (must not be null, must be one of the types defined by DownloadContentTypes)

getActualContentType

java.lang.String getActualContentType()
Returns:
the content type of the data that was actually written to the output stream during the download; null if the download did not complete
See Also:
DownloadContentTypes


© 2015 Microsoft. All rights reserved.