Skip to content
Permalink
Browse files
Remove unused exceptions.
  • Loading branch information
garydgregory committed Feb 8, 2022
1 parent a468818 commit 39abfb17b02acd7d07b0c3ff5bac666a7bd35ea7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 34 deletions.
@@ -104,9 +104,8 @@ public FileVisitResult visitFile(final Path file, final BasicFileAttributes attr
* @param target the stream to write the new archive to.
* @param directory the directory that contains the files to archive.
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be created for other reasons
*/
public void create(final ArchiveOutputStream target, final File directory) throws IOException, ArchiveException {
public void create(final ArchiveOutputStream target, final File directory) throws IOException {
create(target, directory.toPath(), EMPTY_FileVisitOption);
}

@@ -259,10 +259,9 @@ public void expand(final String format, final SeekableByteChannel archive, final
* @param archive the file to expand
* @param targetDirectory the directory to write to
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be read for other reasons
*/
public void expand(final ArchiveInputStream archive, final File targetDirectory)
throws IOException, ArchiveException {
throws IOException {
expand(() -> {
ArchiveEntry next = archive.getNextEntry();
while (next != null && !archive.canReadEntryData(next)) {
@@ -278,11 +277,10 @@ public void expand(final ArchiveInputStream archive, final File targetDirectory)
* @param archive the file to expand
* @param targetDirectory the directory to write to
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be read for other reasons
* @since 1.21
*/
public void expand(final TarFile archive, final File targetDirectory)
throws IOException, ArchiveException {
throws IOException {
final Iterator<TarArchiveEntry> entryIterator = archive.getEntries().iterator();
expand(() -> entryIterator.hasNext() ? entryIterator.next() : null,
(entry, out) -> {
@@ -298,10 +296,9 @@ public void expand(final TarFile archive, final File targetDirectory)
* @param archive the file to expand
* @param targetDirectory the directory to write to
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be read for other reasons
*/
public void expand(final ZipFile archive, final File targetDirectory)
throws IOException, ArchiveException {
throws IOException {
final Enumeration<ZipArchiveEntry> entries = archive.getEntries();
expand(() -> {
ZipArchiveEntry next = entries.hasMoreElements() ? entries.nextElement() : null;
@@ -322,10 +319,9 @@ public void expand(final ZipFile archive, final File targetDirectory)
* @param archive the file to expand
* @param targetDirectory the directory to write to
* @throws IOException if an I/O error occurs
* @throws ArchiveException if the archive cannot be read for other reasons
*/
public void expand(final SevenZFile archive, final File targetDirectory)
throws IOException, ArchiveException {
throws IOException {
expand(archive::getNextEntry, (entry, out) -> {
final byte[] buffer = new byte[8192];
int n;
@@ -152,11 +152,9 @@ public void close() throws IOException {
* @param inputFile file to create an entry from
* @param entryName the name to use
* @return the ArchiveEntry set up with details from the file
*
* @throws IOException on error
*/
public SevenZArchiveEntry createArchiveEntry(final File inputFile,
final String entryName) throws IOException {
final String entryName) {
final SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setDirectory(inputFile.isDirectory());
entry.setName(entryName);
@@ -191,9 +189,8 @@ public SevenZArchiveEntry createArchiveEntry(final Path inputPath,
* {@link #closeArchiveEntry()} to complete the process.
*
* @param archiveEntry describes the entry
* @throws IOException on error
*/
public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException {
public void putArchiveEntry(final ArchiveEntry archiveEntry) {
final SevenZArchiveEntry entry = (SevenZArchiveEntry) archiveEntry;
files.add(entry);
}
@@ -38,9 +38,8 @@ class UnshrinkingInputStream extends LZWInputStream {
* IOException is not actually thrown!
*
* @param inputStream
* @throws IOException IOException is not actually thrown!
*/
public UnshrinkingInputStream(final InputStream inputStream) throws IOException {
public UnshrinkingInputStream(final InputStream inputStream) {
super(inputStream, ByteOrder.LITTLE_ENDIAN);
setClearCode(DEFAULT_CODE_SIZE);
initializeTables(MAX_CODE_SIZE);
@@ -401,10 +401,9 @@ public ZipArchiveOutputStream(final Path path, final long zipSplitSize) throws I
* access.</p>
*
* @param channel the channel to zip to
* @throws IOException on error
* @since 1.13
*/
public ZipArchiveOutputStream(final SeekableByteChannel channel) throws IOException {
public ZipArchiveOutputStream(final SeekableByteChannel channel) {
this.channel = channel;
def = new Deflater(level, true);
streamCompressor = StreamCompressor.create(channel, def);
@@ -36,20 +36,18 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream {
/**
* Creates a Deflate compressed output stream with the default parameters.
* @param outputStream the stream to wrap
* @throws IOException on error
*/
public DeflateCompressorOutputStream(final OutputStream outputStream) throws IOException {
public DeflateCompressorOutputStream(final OutputStream outputStream) {
this(outputStream, new DeflateParameters());
}

/**
* Creates a Deflate compressed output stream with the specified parameters.
* @param outputStream the stream to wrap
* @param parameters the deflate parameters to apply
* @throws IOException on error
*/
public DeflateCompressorOutputStream(final OutputStream outputStream,
final DeflateParameters parameters) throws IOException {
final DeflateParameters parameters) {
this.deflater = new Deflater(parameters.getCompressionLevel(), !parameters.withZlibHeader());
this.out = new DeflaterOutputStream(outputStream, deflater);
}
@@ -49,10 +49,8 @@ public class BlockLZ4CompressorInputStream extends AbstractLZ77CompressorInputSt
*
* @param is
* An InputStream to read compressed data from
*
* @throws IOException if reading fails
*/
public BlockLZ4CompressorInputStream(final InputStream is) throws IOException {
public BlockLZ4CompressorInputStream(final InputStream is) {
super(is, WINDOW_SIZE);
}

@@ -93,10 +93,8 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream {
*
* @param os
* An OutputStream to read compressed data from
*
* @throws IOException if reading fails
*/
public BlockLZ4CompressorOutputStream(final OutputStream os) throws IOException {
public BlockLZ4CompressorOutputStream(final OutputStream os) {
this(os, createParameterBuilder().build());
}

@@ -107,10 +105,8 @@ public BlockLZ4CompressorOutputStream(final OutputStream os) throws IOException
* An OutputStream to read compressed data from
* @param params
* The parameters to use for LZ77 compression.
*
* @throws IOException if reading fails
*/
public BlockLZ4CompressorOutputStream(final OutputStream os, final Parameters params) throws IOException {
public BlockLZ4CompressorOutputStream(final OutputStream os, final Parameters params) {
this.os = os;
compressor = new LZ77Compressor(params,
block -> {
@@ -124,10 +124,9 @@ public abstract class AbstractLZ77CompressorInputStream extends CompressorInputS
* @param windowSize
* Size of the window kept for back-references, must be bigger than the biggest offset expected.
*
* @throws IOException if reading fails
* @throws IllegalArgumentException if windowSize is not bigger than 0
*/
public AbstractLZ77CompressorInputStream(final InputStream is, final int windowSize) throws IOException {
public AbstractLZ77CompressorInputStream(final InputStream is, final int windowSize) {
this.in = new CountingInputStream(is);
if (windowSize <= 0) {
throw new IllegalArgumentException("windowSize must be bigger than 0");

0 comments on commit 39abfb1

Please sign in to comment.