public T[] ReadArray <T>() { if (!IsValid) { throw new PrimitiveValueWrapperException("Trying to access an invalid PrimitiveValueWrapper."); } return(BaseSerializers.ReadArray <T>(ReadBytes())); }
/// <summary> /// Reads an ulong from the Underlaying Stream /// </summary> /// <returns>Deserialized ulong</returns> public ulong ReadULong() { if (!IsValid) { throw new PrimitiveValueWrapperException("Trying to access an invalid PrimitiveValueWrapper."); } byte[] buf = new byte[sizeof(ulong)]; stream.Read(buf, 0, buf.Length); return(BaseSerializers.ReadULong(buf)); }
/// <summary> /// Writes a double to the Stream /// </summary> /// <param name="value">Value to Write</param> /// <returns>Bytes Written</returns> public int Write(double value) { if (!IsValid) { throw new PrimitiveValueWrapperException("Trying to access an invalid PrimitiveValueWrapper."); } byte[] buf = BaseSerializers.Write(value); packetCache.AddRange(buf); return(buf.Length); }
/// <summary> /// Reads a string from the Underlaying Stream /// </summary> /// <returns>Deserialized string</returns> public string ReadString() { if (!IsValid) { throw new PrimitiveValueWrapperException("Trying to access an invalid PrimitiveValueWrapper."); } int len = ReadInt(); byte[] buf = new byte[len]; stream.Read(buf, 0, buf.Length); return(BaseSerializers.ReadString(buf)); }
public void WriteArray <T>(T[] input) { Write(BaseSerializers.WriteArray(input)); }
/// <summary> /// Reads a double from the Underlaying Stream /// </summary> /// <returns>Deserialized double</returns> public double ReadDouble() { byte[] buf = new byte[sizeof(double)]; stream.Read(buf, 0, buf.Length); return(BaseSerializers.ReadDouble(buf)); }