Code example for InputStream

Methods: closemarkreadreset

0
				osToUse = dos;
			} 
 
			if (!isToUse.markSupported()) {
				isToUse = new BufferedInputStream(isToUse);
				isToUse.mark(1);
			} 
 
			int code = isToUse.read();
			int major;
			int minor;
 
			AbstractHessianInput in;
			AbstractHessianOutput out;
 
			if (code == 'H') {
				// Hessian 2.0 stream 
				major = isToUse.read();
				minor = isToUse.read();
				if (major != 0x02) {
					throw new IOException("Version " + major + "." + minor + " is not understood");
				} 
				in = new Hessian2Input(isToUse);
				out = new Hessian2Output(osToUse);
				in.readCall();
			} 
			else if (code == 'C') {
				// Hessian 2.0 call... for some reason not handled in HessianServlet! 
				isToUse.reset();
				in = new Hessian2Input(isToUse);
				out = new Hessian2Output(osToUse);
				in.readCall();
			} 
			else if (code == 'c') {
				// Hessian 1.0 call 
				major = isToUse.read();
				minor = isToUse.read();
				in = new HessianInput(isToUse);
				if (major >= 2) {
					out = new Hessian2Output(osToUse);
				} 
				else { 
					out = new HessianOutput(osToUse);
				} 
			} 
			else { 
				throw new IOException("Expected 'H'/'C' (Hessian 2.0) or 'c' (Hessian 1.0) in hessian input at " + code);
			} 
 
			if (this.serializerFactory != null) {
				in.setSerializerFactory(this.serializerFactory);
				out.setSerializerFactory(this.serializerFactory);
			} 
			if (this.remoteResolver != null) {
				in.setRemoteResolver(this.remoteResolver);
			} 
 
			try { 
				skeleton.invoke(in, out);
			} 
			finally { 
				try { 
					in.close();
					isToUse.close();
				} 
				catch (IOException ex) {
					// ignore 
				} 
				try {