InputStream is = dataURL.openStream(); byte[] b = new byte[6]; int nb = is.read( b ); if ( nb <= 0 ) break;