Reads a binary-serialized XID from a data input stream.

@param dis
Data input stream to read XID from.
@return The read XID object.
182175
public static XID read(DataInputStream dis) throws IOException {
		long msb = dis.readLong();
		long lsb = dis.readLong();
		return new XID(msb, lsb);
	}
252590
public static JavaRDD<LabeledPoint> fromBinary(JavaPairRDD<String, PortableDataStream> binaryFiles,
                    final RecordReader reader) {
        JavaRDD<Collection<Writable>> records =
                        binaryFiles.map(new Function<Tuple2<String, PortableDataStream>, Collection<Writable>>() {
                            @Override
                            public Collection<Writable> call(
                                            Tuple2<String, PortableDataStream> stringPortableDataStreamTuple2)
                                            throws Exception {
                                reader.initialize(new InputStreamInputSplit(stringPortableDataStreamTuple2._2().open(),
                                                stringPortableDataStreamTuple2._1()));
                                return reader.next();
                            }
                        });

        JavaRDD<LabeledPoint> ret = records.map(new Function<Collection<Writable>, LabeledPoint>() {
            @Override
            public LabeledPoint call(Collection<Writable> writables) throws Exception {
                return pointOf(writables);
            }
        });
        return ret;
    }
1105503
protected Object deserialize(byte[] in) {
        Object rv = null;
        try {
            if (in != null) {
                ByteArrayInputStream bis = new ByteArrayInputStream(in);
                ObjectInputStream is = new ObjectInputStream(bis);
                rv = is.readObject();
                is.close();
                bis.close();
            }
        } catch (IOException e) {
            logger.warn("Caught IOException decoding %d bytes of data", e);
        } catch (ClassNotFoundException e) {
            logger.warn("Caught CNFE decoding %d bytes of data", e);
        }
        return rv;
    }
741804
protected Object deserialize(byte[] in) {
    Object rv = null;
    ByteArrayInputStream bis = null;
    ObjectInputStream is = null;
    try {
      if (in != null) {
        bis = new ByteArrayInputStream(in);
        is = new XmcObjectInputStream(bis);
        rv = is.readObject();

      }
    } catch (IOException e) {
      log.error("Caught IOException decoding " + in.length + " bytes of data", e);
    } catch (ClassNotFoundException e) {
      log.error("Caught CNFE decoding " + in.length + " bytes of data", e);
    } finally {
      if (is != null) {
        try {
          is.close();
        } catch (IOException e) {
          // ignore
        }
      }
      if (bis != null) {
        try {
          bis.close();
        } catch (IOException e) {
          // ignore
        }
      }
    }
    return rv;
  }
893728
public static void write(XID id, DataOutputStream dos) throws IOException {
		dos.writeLong(id.uuid.getMostSignificantBits());
		dos.writeLong(id.uuid.getLeastSignificantBits());
	}
145865
public void readFrom (@Nonnull @WillNotClose final InputStream aIS) throws IOException
  {
    while (true)
    {
      if (m_nCount == m_aBuf.length)
      {
        // reallocate
        m_aBuf = _enlarge (m_aBuf, m_aBuf.length << 1);
      }

      final int nBytesRead = aIS.read (m_aBuf, m_nCount, m_aBuf.length - m_nCount);
      if (nBytesRead < 0)
        return;
      m_nCount += nBytesRead;
    }
  }
368269
public static DTDSubset readInternalSubset(WstxInputData srcData,
                                               WstxInputSource input,
                                               ReaderConfig cfg,
                                               boolean constructFully,
                                               int xmlVersion)
        throws XMLStreamException
    {
        FullDTDReader r = new FullDTDReader(input, cfg, constructFully, xmlVersion);
        // Need to read using the same low-level reader interface:
        r.copyBufferStateFrom(srcData);
        DTDSubset ss;

        try {
            ss = r.parseDTD();
        } finally {
            /* And then need to restore changes back to owner (line nrs etc);
             * effectively means that we'll stop reading external DTD subset,
             * if so.
             */
            srcData.copyBufferStateFrom(r);
        }
        return ss;
    }
89955
public byte[] getDescription(int objIndex, int pid, int propIndex)
		throws KNXException
	{
		return mc.readPropertyDesc(dst, objIndex, pid, propIndex);
	}
1288005
public <T> T read(final String s, final DataTypeDescriptor<T> descriptor)
			throws Exception {
		if (descriptor == null) throw new NullPointerException("descriptor");
		if (s == null) return null;

		JsonParser parser = factory.createParser(s);
		return read(parser, descriptor);
	}
1360368
public static Guid fromHasGuid(HasGuid... objs) throws IOException {
    byte[][] byteArrays = new byte[objs.length][];
    for (int i = 0; i < objs.length; i++) {
      byteArrays[i] = objs[i].guid().sha;
    }
    return fromByteArrays(byteArrays);
  }
645431
public void decode(AsnInputStream ais) throws AsnException {
		
		this.oid = false;
		this.integer = false;
		this.objDescriptor = false;
		this.oidValue = null;
		this.indirectReference = 0;
		this.objDescriptorValue = null;
		this.asn = false;
		this.octet = false;
		this.arbitrary = false;
		this.data = null;
		this.bitDataString = null;
		
		try {

			// The definition of EXTERNAL is
			//			
			// EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE {
			// direct-reference OBJECT IDENTIFIER OPTIONAL,
			// indirect-reference INTEGER OPTIONAL,
			// data-value-descriptor ObjectDescriptor OPTIONAL,
			// encoding CHOICE {
			// single-ASN1-type [0] ANY,
			// octet-aligned [1] IMPLICIT OCTET STRING,
			// arbitrary [2] IMPLICIT BIT STRING }}
			//
			//			

			AsnInputStream localAsnIS = ais.readSequenceStream();
			
			while( true ) {
				if (localAsnIS.available() == 0)
					break;
				
				int tag = localAsnIS.readTag();
				if (localAsnIS.getTagClass() == Tag.CLASS_UNIVERSAL) {
					switch(tag) {
					case Tag.INTEGER:
						this.indirectReference = localAsnIS.readInteger();
						this.setInteger(true);
						break;
						
					case Tag.OBJECT_IDENTIFIER:
						this.oidValue = localAsnIS.readObjectIdentifier();
						this.setOid(true);
						break;
						
					case Tag.OBJECT_DESCRIPTOR:
						this.objDescriptorValue = localAsnIS.readGraphicString();
						this.setObjDescriptor(true);
						break;
						
					default:
						throw new AsnException("Error while decoding External: Unrecognized tag value=" + tag + ", tagClass=" + localAsnIS.getTagClass());
					}
				} else if (localAsnIS.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
					
					switch(tag) {
					case External._TAG_ASN:
						this.data = localAsnIS.readSequence();
						this.setAsn(true);
						break;
						
					case External._TAG_OCTET_ALIGNED:
						this.setEncodeType(localAsnIS.readOctetString());
						setOctet(true);
						break;
						
					case External._TAG_ARBITRARY:
						this.setEncodeBitStringType(localAsnIS.readBitString());
						setArbitrary(true);
						break;
						
					default:
						throw new AsnException("Error while decoding External: Unrecognized tag value=" + tag + ", tagClass=" + localAsnIS.getTagClass());
					}

					// check: this field  must be the last
					if (localAsnIS.available() != 0)
						throw new AsnException("Error while decoding External: data field must be the last");

				} else {
					throw new AsnException("Error while decoding External: Unrecognized tag value=" + tag + ", tagClass=" + localAsnIS.getTagClass());
				}
			}
		} catch (IOException e) {
			throw new AsnException("IOException while decoding External: " + e.getMessage(), e);
		}
	}
1056562
public void deserialize(DataInput in) throws IOException {
    this.clear();
    // little endian
    final int cookie = Integer.reverseBytes(in.readInt());
    if ((cookie & 0xFFFF) != SERIAL_COOKIE && cookie != SERIAL_COOKIE_NO_RUNCONTAINER) {
      throw new InvalidRoaringFormat("I failed to find a valid cookie.");
    }
    this.size = ((cookie & 0xFFFF) == SERIAL_COOKIE) ? (cookie >>> 16) + 1
        : Integer.reverseBytes(in.readInt());
    // logically we cannot have more than (1<<16) containers.
    if(this.size > (1<<16)) {
      throw new InvalidRoaringFormat("Size too large");
    }
    if ((this.keys == null) || (this.keys.length < this.size)) {
      this.keys = new short[this.size];
      this.values = new MappeableContainer[this.size];
    }

    byte[] bitmapOfRunContainers = null;
    boolean hasrun = (cookie & 0xFFFF) == SERIAL_COOKIE;
    if (hasrun) {
      bitmapOfRunContainers = new byte[(size + 7) / 8];
      in.readFully(bitmapOfRunContainers);
    }

    final short keys[] = new short[this.size];
    final int cardinalities[] = new int[this.size];
    final boolean isBitmap[] = new boolean[this.size];
    for (int k = 0; k < this.size; ++k) {
      keys[k] = Short.reverseBytes(in.readShort());
      cardinalities[k] = 1 + (0xFFFF & Short.reverseBytes(in.readShort()));
      isBitmap[k] = cardinalities[k] > MappeableArrayContainer.DEFAULT_MAX_SIZE;
      if (bitmapOfRunContainers != null && (bitmapOfRunContainers[k / 8] & (1 << (k % 8))) != 0) {
        isBitmap[k] = false;
      }
    }
    if ((!hasrun) || (this.size >= NO_OFFSET_THRESHOLD)) {
      // skipping the offsets
      in.skipBytes(this.size * 4);
    }
    // Reading the containers
    for (int k = 0; k < this.size; ++k) {
      MappeableContainer val;
      if (isBitmap[k]) {
        final LongBuffer bitmapArray =
            LongBuffer.allocate(MappeableBitmapContainer.MAX_CAPACITY / 64);
        // little endian
        for (int l = 0; l < bitmapArray.limit(); ++l) {
          bitmapArray.put(l, Long.reverseBytes(in.readLong()));
        }
        val = new MappeableBitmapContainer(bitmapArray, cardinalities[k]);
      } else if (bitmapOfRunContainers != null
          && ((bitmapOfRunContainers[k / 8] & (1 << (k % 8))) != 0)) {
        int nbrruns = toIntUnsigned(Short.reverseBytes(in.readShort()));
        final ShortBuffer shortArray = ShortBuffer.allocate(2 * nbrruns);
        for (int l = 0; l < shortArray.limit(); ++l) {
          shortArray.put(l, Short.reverseBytes(in.readShort()));
        }
        val = new MappeableRunContainer(shortArray, nbrruns);
      } else {
        final ShortBuffer shortArray = ShortBuffer.allocate(cardinalities[k]);
        for (int l = 0; l < shortArray.limit(); ++l) {
          shortArray.put(l, Short.reverseBytes(in.readShort()));
        }
        val = new MappeableArrayContainer(shortArray, cardinalities[k]);
      }
      this.keys[k] = keys[k];
      this.values[k] = val;
    }
  }
904871
protected int readByte(InputStream in, CRC32 crc) throws IOException {
        int b = in.read();
        if (b == -1) {
            throw new EOFException();
        }
        if (crc != null) {
            crc.update(b);
        }
        return b & 0xff;
    }
234028
public int read(long pos) {
    if (pos >= size) {
      return -1;
    }

    byte[] block = blocks[blockIndex(pos)];
    int off = offsetInBlock(pos);
    return UnsignedBytes.toInt(block[off]);
  }
236041
public static final int readNaturalNumber(OInput dis) throws IOException {

		int naturalNumber = 0;
		byte b1 = dis.readByte();
		
		if( b1 >= 0) {
			naturalNumber = b1;
		} else {
			byte b2 = dis.readByte();
			
			if(b2 >= 0) {
				naturalNumber = b1 * dv1 * -1 ;
				naturalNumber += b2;
			} else {
				
				byte b3 = dis.readByte();
				
				if(b3 >= 0) {
					naturalNumber += b1  * dv2 * -1;
					naturalNumber += (b2+1) * dv1 * -1;
					naturalNumber += b3;
				} else {
					byte b4 = dis.readByte();
					
					if(b4 >=0) {
						naturalNumber += b1  * dv3 * -1;
						naturalNumber += (b2+1) * dv2 * -1;
						naturalNumber += (b3+1) * dv1 * -1;
						naturalNumber += b4;
						
					} else {
						byte b5 = dis.readByte();

						naturalNumber += b1  * dv4 * -1;
						naturalNumber += (b2+1) * dv3 * -1;
						naturalNumber += (b3+1) * dv2 * -1;
						naturalNumber += (b4+1) * dv1 * -1;
						naturalNumber += b5;

					}
				}
			}
		}
		
		return naturalNumber;
	}
1157399
public static DTDSubset readExternalSubset
        (WstxInputSource src, ReaderConfig cfg, DTDSubset intSubset, 
         boolean constructFully, int xmlVersion)
        throws XMLStreamException
    {
        FullDTDReader r = new FullDTDReader(src, cfg, intSubset, constructFully, xmlVersion);
        return r.parseDTD();
    }
1244177
public static final Object deserialize(byte[] bytes) throws Exception {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(tc, "deserialize");

        Object o;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
            ObjectInputStream oin = new ObjectInputStream(bis);
            o = oin.readObject();
            oin.close();
        } catch (IOException e) {
            FFDCFilter.processException(e, ConnectorService.class.getName(), "151");
            if (trace && tc.isEntryEnabled())
                Tr.exit(tc, "deserialize", new Object[] { toString(bytes), e });
            throw e;
        }

        if (trace && tc.isEntryEnabled())
            Tr.exit(tc, "deserialize", o == null ? null : o.getClass());
        return o;
    }