@Override public InputStream accessInputStream() { try { return new BufferedInputStream( new FileInputStream( file ) ); } catch (FileNotFoundException e) { // should never ever ever happen, but... throw new ArchiveException( "File believed to exist based on File.exists threw error when passed to FileInputStream ctor", e ); } } }
@Override public InputStream accessInputStream() { try { return virtualFile.openStream(); } catch (IOException e) { throw new ArchiveException( "Unable to open VirtualFile-based InputStream", e ); } }
@Override public InputStream accessInputStream() { try { return virtualFile.openStream(); } catch (IOException e) { throw new ArchiveException( "Unable to open VirtualFile-based InputStream", e ); } }
@Override public InputStream accessInputStream() { try { return virtualFile.openStream(); } catch (IOException e) { throw new ArchiveException( "Unable to open VirtualFile-based InputStream", e ); } }
/** * Extracts the bytes out of an InputStream. This form is the same as {@link #getBytesFromInputStream} * except that any {@link IOException} are wrapped as (runtime) {@link ArchiveException} * * @param inputStream The stream from which to extract bytes. * * @return The bytes * * @throws ArchiveException Indicates a problem accessing the stream */ public static byte[] getBytesFromInputStreamSafely(InputStream inputStream) throws ArchiveException { try { return getBytesFromInputStream( inputStream ); } catch (IOException e) { throw new ArchiveException( "Unable to extract bytes from InputStream", e ); } }
private ClassFile toClassFile(ArchiveEntry entry) { final InputStream inputStream = entry.getStreamAccess().accessInputStream(); final DataInputStream dataInputStream = new DataInputStream( inputStream ); try { return new ClassFile( dataInputStream ); } catch (IOException e) { throw new ArchiveException( "Could not build ClassFile", e ); } finally { try { dataInputStream.close(); } catch (Exception ignore) { } try { inputStream.close(); } catch (IOException ignore) { } } }
throw new ArchiveException( String.format( "Unable to access stream from jar file [%s] for entry [%s]", throw new ArchiveException( "Error accessing jar file [" + rootFile.getAbsolutePath() + "]", e );
throw new ArchiveException( "Error accessing JarFile entry [" + zipEntry.getName() + "]", e ); throw new ArchiveException( String.format( "Unable to access stream from jar file [%s] for entry [%s]",
throw new ArchiveException( "Error accessing nested jar", e ); throw new ArchiveException( String.format( "Error accessing JarInputStream [%s]", getArchiveUrl() ), ioe
@Override public InputStream accessInputStream() { try { return new BufferedInputStream( new FileInputStream( file ) ); } catch (FileNotFoundException e) { // should never ever ever happen, but... throw new ArchiveException( "File believed to exist based on File.exists threw error when passed to FileInputStream ctor", e ); } } }
@Override public InputStream accessInputStream() { try { return virtualFile.openStream(); } catch (IOException e) { throw new ArchiveException( "Unable to open VirtualFile-based InputStream", e ); } }
@Override public InputStream accessInputStream() { try { return virtualFile.openStream(); } catch (IOException e) { throw new ArchiveException( "Unable to open VirtualFile-based InputStream", e ); } }
/** * Extracts the bytes out of an InputStream. This form is the same as {@link #getBytesFromInputStream} * except that any {@link IOException} are wrapped as (runtime) {@link ArchiveException} * * @param inputStream The stream from which to extract bytes. * * @return The bytes * * @throws ArchiveException Indicates a problem accessing the stream */ public static byte[] getBytesFromInputStreamSafely(InputStream inputStream) throws ArchiveException { try { return getBytesFromInputStream( inputStream ); } catch (IOException e) { throw new ArchiveException( "Unable to extract bytes from InputStream", e ); } }
private ClassFile toClassFile(ArchiveEntry entry) { final InputStream inputStream = entry.getStreamAccess().accessInputStream(); final DataInputStream dataInputStream = new DataInputStream( inputStream ); try { return new ClassFile( dataInputStream ); } catch (IOException e) { throw new ArchiveException( "Could not build ClassFile", e ); } finally { try { dataInputStream.close(); } catch (Exception ignore) { } try { inputStream.close(); } catch (IOException ignore) { } } }
throw new ArchiveException( String.format( "Unable to access stream from jar file [%s] for entry [%s]", throw new ArchiveException( "Error accessing jar file [" + rootFile.getAbsolutePath() + "]", e );
throw new ArchiveException( "Error accessing JarFile entry [" + zipEntry.getName() + "]", e ); throw new ArchiveException( String.format( "Unable to access stream from jar file [%s] for entry [%s]",
throw new ArchiveException( "Error accessing nested jar", e ); throw new ArchiveException( String.format( "Error accessing JarInputStream [%s]", getArchiveUrl() ), ioe