@Override
	public ArrayList<ProtocolUnit> read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) {

		UnitByte temp;
		value = new ArrayList<ProtocolUnit>();

		while(true) {

			temp = new UnitByte();

			if(temp.read(in, ptc, thread, serverToClient, linkState) == null) {
				return null;
			} else {
				value.add(temp);
				if(temp.getValue() == 0x7F) {
					return value;
				}
				Byte select = (byte)(( temp.getValue() >> 5 ) & 0x7);
				ProtocolUnit element = null;
				switch(select) {
				case 0: element = new UnitByte(); break;
				case 1: element = new UnitShort(); break;
				case 2: element = new UnitInteger(); break;
				case 3: element = new UnitFloat(); break;
				case 4: element = new UnitString(); break;
				default: {
					ptc.printLogMessage("Unknown meta data code (" + temp + ") - breaking connection");
					return null;
				}
				}
				if(element.read(in, ptc, thread, serverToClient, linkState) == null) {
					return null;
				}
				value.add(element);
			}


		}

	}