/** * Method description * * * @param in * @param out * * @throws IOException */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in, out, DEFAULT_BUFFERSIZE); }
/** * Method description * * * @param reader * @param writer * * @throws IOException */ public static void copy(Reader reader, Writer writer) throws IOException { copy(reader, writer, DEFAULT_BUFFERSIZE); }
/** * Method description * * * @param in * @param out * * @throws IOException */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in, out, DEFAULT_BUFFERSIZE); }
/** * Method description * * * @param reader * @param writer * * @throws IOException */ public static void copy(Reader reader, Writer writer) throws IOException { copy(reader, writer, DEFAULT_BUFFERSIZE); }
private void writeBlobIntoResponse(Blob savedBlob, HttpServletResponse response) throws IOException { try (ServletOutputStream responseOutputStream = response.getOutputStream(); InputStream savedBlobInputStream = savedBlob.getInputStream()) { response.addHeader(HttpSupport.HDR_CONTENT_LENGTH, String.valueOf(savedBlob.getSize())); response.setContentType(Constants.HDR_APPLICATION_OCTET_STREAM); IOUtil.copy(savedBlobInputStream, responseOutputStream); } catch (IOException ex) { sendErrorAndLog(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, ex); } }
/** * Method description * * * @param input * @param outputFile * * @throws IOException */ private void extractFile(ZipInputStream input, File outputFile) throws IOException { FileOutputStream output = null; try { output = new FileOutputStream(outputFile); IOUtil.copy(input, output); } finally { IOUtil.close(output); } } }
/** * Method description * * * @param input * @param outputFile * * @throws IOException */ private void extractFile(ZipInputStream input, File outputFile) throws IOException { FileOutputStream output = null; try { output = new FileOutputStream(outputFile); IOUtil.copy(input, output); } finally { IOUtil.close(output); } } }
/** * Method description * */ @Override public void run() { try { copy(reader, writer, bufferSize); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } finally { close(reader); close(writer); } }
/** * Method description * */ @Override public void run() { try { copy(reader, writer, bufferSize); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } finally { close(reader); close(writer); } }
/** * Method description * */ @Override public void run() { try { copy(input, output, bufferSize); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } finally { close(input); close(output); } }
/** * Method description * */ @Override public void run() { try { copy(input, output, bufferSize); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } finally { close(input); close(output); } }
/** * Method description * * * @param in * * @return * @since 1.8 * * @throws IOException */ public static String getContent(InputStream in) throws IOException { String content = null; ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); copy(in, baos); content = baos.toString(); } finally { close(baos); close(in); } return content; }
/** * Method description * * * @param in * * @return * @since 1.8 * * @throws IOException */ public static String getContent(InputStream in) throws IOException { String content = null; ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); copy(in, baos); content = baos.toString(); } finally { close(baos); close(in); } return content; }
private void readBlobFromResponse(HttpServletRequest request, HttpServletResponse response, AnyLongObjectId objectId) throws IOException { Blob blob = blobStore.create(objectId.getName()); try (OutputStream blobOutputStream = blob.getOutputStream(); ServletInputStream requestInputStream = request.getInputStream()) { IOUtil.copy(requestInputStream, blobOutputStream); blob.commit(); response.setContentType(Constants.CONTENT_TYPE_GIT_LFS_JSON); response.setStatus(HttpServletResponse.SC_OK); } catch (CorruptLongObjectException ex) { sendErrorAndLog(response, HttpStatus.SC_BAD_REQUEST, ex); } }
IOUtil.copy(templateDirectory, new File(libDir, FILE_TEMPLATES));
IOUtil.copy(input, output);
/** * Method description * * * @param revision * @param path * @param output * * * @throws IOException * @throws RepositoryException */ @Override public void getContent(String revision, String path, OutputStream output) throws IOException, RepositoryException { revision = HgUtil.getRevision(revision); Process p = createHgProcess("cat", "-r", revision, Util.nonNull(path)); InputStream input = null; try { handleErrorStream(p.getErrorStream()); input = p.getInputStream(); IOUtil.copy(input, output); } finally { IOUtil.close(input); } }
script.getResourcePath()); output = new FileOutputStream(script.getFile(context)); IOUtil.copy(content, output);
IOUtil.copy(input, output);