Code example for CountingOutputStream

Methods: getCount

0
		this.out = new PrintStream(out);
	} 
 
	public void output(Resource resource) throws IOException {
		OutputStream nullo = ByteStreams.nullOutputStream();
		CountingOutputStream co = new CountingOutputStream(nullo);
		StreamCopy.copy(resource.getInputStream(), co);
		long bytes = co.getCount();
		if(bytes > 0) {
			LOG.info(bytes + " unconsumed bytes in Resource InputStream.");
		} 
		try { 
			out.println(resource.getMetaData().getTopMetaData().toString(1));
		} catch (JSONException e) {
			LOG.warning(e.getMessage());
		}		 
	} 
} 
Experience pair programming with AI  Get Codota for Java