private ZipEntry nextEntry(final ZipInputStream input, final String location) throws IOException { try { return input.getNextEntry(); } catch (final IOException e) { throw instrumentError(location, e); } }
private int read(final InputStream input, final byte[] buffer, final String name) throws IOException { try { return input.read(buffer); } catch (final IOException e) { throw instrumentError(name, e); } }
private int instrumentGzip(final InputStream input, final OutputStream output, final String name) throws IOException { final GZIPInputStream gzipInputStream; try { gzipInputStream = new GZIPInputStream(input); } catch (final IOException e) { throw instrumentError(name, e); } final GZIPOutputStream gzout = new GZIPOutputStream(output); final int count = instrumentAll(gzipInputStream, gzout, name); gzout.finish(); return count; }
/** * Creates a instrumented version of the given class if possible. * * @param buffer * definition of the class * @param name * a name used for exception messages * @return instrumented definition * @throws IOException * if the class can't be instrumented */ public byte[] instrument(final byte[] buffer, final String name) throws IOException { try { return instrument(buffer); } catch (final RuntimeException e) { throw instrumentError(name, e); } }
private int instrumentPack200(final InputStream input, final OutputStream output, final String name) throws IOException { final InputStream unpackedInput; try { unpackedInput = Pack200Streams.unpack(input); } catch (final IOException e) { throw instrumentError(name, e); } final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final int count = instrumentAll(unpackedInput, buffer, name); Pack200Streams.pack(buffer.toByteArray(), output); return count; }
/** * Creates a instrumented version of the given class if possible. The * provided {@link InputStream} is not closed by this method. * * @param input * stream to read class definition from * @param name * a name used for exception messages * @return instrumented definition * @throws IOException * if reading data from the stream fails or the class can't be * instrumented */ public byte[] instrument(final InputStream input, final String name) throws IOException { final byte[] bytes; try { bytes = InputStreams.readFully(input); } catch (final IOException e) { throw instrumentError(name, e); } return instrument(bytes, name); }
detector = new ContentTypeDetector(input); } catch (final IOException e) { throw instrumentError(name, e);