コード例 #1
0
 private InputStream copyIn(InputStream in) throws Exception {
   try (CachedOutputStream bos = new CachedOutputStream()) {
     IOUtils.copyAndCloseInput(in, bos);
     in = bos.getInputStream();
     bos.close();
     return in;
   }
 }
コード例 #2
0
 @Override
 protected void doClose() {
   Reader transformedReader = null;
   try {
     transformedReader = XSLTUtils.transform(xsltTemplate, getReader());
     IOUtils.copyAndCloseInput(transformedReader, origWriter, IOUtils.DEFAULT_BUFFER_SIZE);
   } catch (IOException e) {
     throw new Fault("READER_COPY", LOG, e, e.getMessage());
   } finally {
     try {
       origWriter.close();
     } catch (IOException e) {
       LOG.warning("Cannot close stream after transformation: " + e.getMessage());
     }
   }
 }
コード例 #3
0
 @Override
 public void onClose(CachedOutputStream wrapper) {
   InputStream transformedStream = null;
   try {
     transformedStream = XSLTUtils.transform(xsltTemplate, wrapper.getInputStream());
     IOUtils.copyAndCloseInput(transformedStream, origStream);
   } catch (IOException e) {
     throw new Fault("STREAM_COPY", LOG, e, e.getMessage());
   } finally {
     try {
       origStream.close();
     } catch (IOException e) {
       LOG.warning("Cannot close stream after transformation: " + e.getMessage());
     }
   }
 }