Code example for InputStream

Methods: read

0
	} 
	 
	public static int read(InputStream is, byte[] buf)
	{ 
		try { 
			int n = is.read(buf);
			return n == -1 ? 0 : n;
		} 
		catch (Exception e) {
			return -1; 
		} 
	} 
	 
	public static void seek(InputStream is, int offset)
	{ 
		try { 
			is.reset();
			for (long total = 0; total < offset;) {
				long n = is.skip(offset - total);
				if (n == 0)
					break;