private IoSample parseIoSample(IIntArrayInputStream ps) throws IOException {

		IoSample sample = new IoSample(this);
		
		// DIO 8 occupies the first bit of the adcHeader
		if (this.containsDigital()) {
			// at least one DIO line is active
			// next two bytes are DIO
			
			log.debug("Digital I/O was received");
			
			sample.setDioMsb(ps.read("DIO MSB"));
			sample.setDioLsb(ps.read("DIO LSB"));
		}
		
		// ADC is active if any of bits 2-7 are on
		if (this.containsAnalog()) {
			// adc is active
			// adc is 10 bits
			
			log.debug("Analog input was received");
			
			// 10-bit values are read two bytes per sample
			
			int analog = 0;
			
			// Analog inputs A0-A5 are bits 2-7 of the adcHeader
			
			if (this.isA0Enabled()) {
				sample.setAnalog0(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;				
			}

			if (this.isA1Enabled()) {
				sample.setAnalog1(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;
			}

			if (this.isA2Enabled()) {
				sample.setAnalog2(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;
			}

			if (this.isA3Enabled()) {
				sample.setAnalog3(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;
			}

			if (this.isA4Enabled()) {
				sample.setAnalog4(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;
			}
			
			if (this.isA5Enabled()) {
				sample.setAnalog5(ByteUtils.parse10BitAnalog(ps, analog));
				analog++;
			}
			
			log.debug("There are " + analog + " analog inputs turned on");
		}
		
		return sample;
	}