List of usage examples for org.apache.commons.io.output CountingOutputStream write
public void write(int b) throws IOException
From source file:com.discursive.jccook.io.CountingOutExample.java
public void start() { File test = new File("test.dat"); CountingOutputStream countStream = null; try {// w ww. j a v a2s. c o m FileOutputStream fos = new FileOutputStream(test); countStream = new CountingOutputStream(fos); countStream.write("Hello".getBytes()); } catch (IOException ioe) { System.out.println("Error writing bytes to file."); } finally { IOUtils.closeQuietly(countStream); } if (countStream != null) { int bytesWritten = countStream.getCount(); System.out.println("Wrote " + bytesWritten + " bytes to test.dat"); } }