Interface Archive
- All Known Implementing Classes:
TgzArchiveWrapper
,ZipArchiveWrapper
public interface Archive
The interface
Archive
contains the common description for a ZIP
and tar.gz archive.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
The interfaceEntry
contains the wrapper definition for an archive entry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
The methodclose
provides means to close the stream.void
The methodcloseEntry
provides means to close the current entry.getName()
The methodgetName
provides means to retrieve the file name.The methodgetNextEntry
provides means to move to the next entry.The methodgetStream
provides means to get the InputStream for the current entry.static Archive
of
(@NonNull String name, InputStream in) The methodof
provides means to create a wrapper for an archive file.static Archive
tgz
(String name, InputStream in) The methodtgz
provides means to create a wrapper for a tar.gz file.static Archive
zip
(String name, InputStream in) The methodzip
provides means to create a wrapper for a ZIP file.
-
Method Details
-
of
The methodof
provides means to create a wrapper for an archive file.- Parameters:
name
- the file namein
- the file to wrap- Returns:
- the new archive wrapper for the file
- Throws:
IOException
- in case of an I/O error
-
tgz
The methodtgz
provides means to create a wrapper for a tar.gz file.- Parameters:
name
- the file namein
- the file to wrap- Returns:
- the new archive wrapper for the file
- Throws:
IOException
- in case of an I/O errorFileNotFoundException
- in case the file has not been found.
-
zip
The methodzip
provides means to create a wrapper for a ZIP file.- Parameters:
name
- the file namein
- the file content- Returns:
- the new archive wrapper for the file
- Throws:
FileNotFoundException
- in case the file has not been found.
-
close
The methodclose
provides means to close the stream.- Throws:
IOException
- in case of an I/O error
-
closeEntry
The methodcloseEntry
provides means to close the current entry.- Throws:
IOException
- in case of an I/O error
-
getName
String getName()The methodgetName
provides means to retrieve the file name.- Returns:
- the file name or null
-
getNextEntry
The methodgetNextEntry
provides means to move to the next entry.- Returns:
- the next entry
- Throws:
IOException
- in case of an I/O error
-
getStream
InputStream getStream()The methodgetStream
provides means to get the InputStream for the current entry.- Returns:
- the InputStream for the current entry
-