Skip to content

Instantly share code, notes, and snippets.

@ALRubinger
Created July 22, 2010 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ALRubinger/486584 to your computer and use it in GitHub Desktop.
Save ALRubinger/486584 to your computer and use it in GitHub Desktop.
public interface StreamExporter extends Assignable
{
//-------------------------------------------------------------------------------------||
// Contracts --------------------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
/**
* Exports this reference in an implementation-specific
* format represented by the returned {@link InputStream}
*
* @return {@link InputStream} to read the exported view
*/
InputStream export();
/**
* Exports provided archive in an implementation-specific format,
* written to the specified {@link OutputStream} target. The specified
* target will be closed upon completion.
*
* @param target
* @throws ArchiveExportException
* @throws IllegalArgumentException If the target is not specified or is closed
*/
void exportTo(OutputStream target) throws ArchiveExportException, IllegalArgumentException;
/**
* Exports provided archive as in an implementation-specific format, written to the
* specified {@link File} target. If the target exists this call will
* fail with {@link IllegalArgumentException}
*
* @param archive
* @throws IllegalArgumentException If the target is not specified
* @throws FileExistsException If the target already exists
* @throws ArchiveExportException if the export process fails
*/
void exportTo(File target) throws ArchiveExportException, FileExistsException, IllegalArgumentException;
/**
* Exports provided archive an implementation-specific format, written to the
* specified {@link File} target. If the target both exists and the "overwrite"
* flag is true, this call will allow the existing file to be overwritten, else
* the invocation will fail with {@link IllegalArgumentException}
*
* @param archive
* @throws IllegalArgumentException If the target is not specified
* @throws FileExistsException If the target both already exists and the overwrite flag is false
* @throws ArchiveExportException if the export process fails
*/
void exportTo(File target, boolean overwrite) throws ArchiveExportException, FileExistsException,
IllegalArgumentException;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment