Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; public class Main { public static int getInputStreamSize(InputStream in) { try { if (in != null) return in.available(); } catch (IOException e) { e.printStackTrace(); } return 0; } }