private static void ZLib(Stream memoryStream, BinaryDataType binaryDataType, double[] values) { using (var deflateStream = new DeflateStream(memoryStream, CompressionMode.Compress, true)) { NoCompression(deflateStream, binaryDataType, values); } }
internal PeakArray( BinaryDataCompressionType compressionType, BinaryDataType intensityDataType) { this.compressionType = compressionType; this.intensityDataType = intensityDataType; }
public Peak1DArray( [JsonProperty("CompressionType")] BinaryDataCompressionType compressionType, [JsonProperty("IntensityDataType")] BinaryDataType intensityDataType, [JsonProperty("MzDataType")] BinaryDataType mzDataType) : base(compressionType, intensityDataType) { this.mzDataType = mzDataType; }
internal PeakArray( int arrayLength, BinaryDataCompressionType compressionType, BinaryDataType intensityDataType) { this.compressionType = compressionType; this.intensityDataType = intensityDataType; this.arrayLength = arrayLength; }
private static void NoCompression(Stream memoryStream, BinaryDataType binaryDataType, double[] values) { using (var writer = new BinaryWriter(memoryStream, Encoding.UTF8, true)) { foreach (var v in values) { WriteValue(writer, binaryDataType, v); } } }
public Peak1DArray( [JsonProperty("ArrayLength")] int arrayLength, [JsonProperty("CompressionType")] BinaryDataCompressionType compressionType, [JsonProperty("IntensityDataType")] BinaryDataType intensityDataType, [JsonProperty("MzDataType")] BinaryDataType mzDataType) : base(arrayLength, compressionType, intensityDataType) { this.mzDataType = mzDataType; this.peaks = new Peak1D[arrayLength]; }
/// <summary> /// Resolves the specified data type. /// </summary> /// <param name="dataType">Data type specification.</param> /// <returns>Resolved EDM Type.</returns> PrimitiveDataType IPrimitiveDataTypeVisitor <PrimitiveDataType> .Visit(BinaryDataType dataType) { int? maxLength = null; MaxLengthFacet maxLengthFacet; if (dataType.TryGetFacet(out maxLengthFacet)) { maxLength = maxLengthFacet.Value; } return(EdmDataTypes.Binary(maxLength)); }
private TypeInfo CreateBinaryType(BinaryDataType binaryType) { if (binaryType.Width != null) { var width = evaluator_.EvaluateNonIndeterminate(binaryType.Width); return(new BinaryTypeInfo(width, binaryType.IsFixed)); } else { return(TypeInfo.Binary); } }
private BinaryData GetBinaryData(BinaryDataType type) { var binaryData = this.getBinaryData(type); if (!binaryDataToBufferIndex.ContainsKey(binaryData)) { var buffer = CreateInstance <Schema.Buffer>(); buffer.Uri = binaryData.Name; var bufferIndex = buffers.Count; buffers.Add(buffer); binaryDataToBufferIndex.Add(binaryData, bufferIndex); } return(binaryData); }
public void Process() { rows = int.Parse(data[rowsKey]); columns = int.Parse(data[columnsKey]); if (int.Parse(data[byteOrderKey]) != byteOrderLittleEndian) { throw new System.ArgumentException( "Unsupported byte order " + byteOrderKey + "! (We currently only support little endian byte order)" ); } dataType = ProcessDataType(); ProcessMapInfo(); processingDone = true; }
private void WriteBinaryDataArray(double[] values, BinaryDataType binaryDataType, UserDescription pars) { BinaryDataEncoder encoder = new BinaryDataEncoder(values.Length * 8); string base64 = encoder.EncodeBase64(values, BinaryDataCompressionType.NoCompression, binaryDataType); int len = base64.Length; writer.WriteStartElement("binaryDataArray"); WriteXmlAttribute("encodedLength", len.ToString(formatProvider)); WriteParamGroup(pars); writer.WriteStartElement("binary"); writer.WriteString(base64); writer.WriteEndElement(); writer.WriteEndElement(); }
/// <summary> /// Initializes static members of the DataTypes class. /// </summary> static DataTypes() { Integer = new IntegerDataType(); Stream = new StreamDataType(); String = new StringDataType(); Boolean = new BooleanDataType(); FixedPoint = new FixedPointDataType(); FloatingPoint = new FloatingPointDataType(); DateTime = new DateTimeDataType(); Binary = new BinaryDataType(); Guid = new GuidDataType(); TimeOfDay = new TimeOfDayDataType(); ComplexType = new ComplexDataType(); EntityType = new EntityDataType(); CollectionType = new CollectionDataType(); ReferenceType = new ReferenceDataType(); RowType = new RowDataType(); EnumType = new EnumDataType(); Spatial = new SpatialDataType(); }
private static double ReadValue(BinaryReader reader, BinaryDataType binaryDataType) { switch (binaryDataType) { case BinaryDataType.Float32: return(decimal.ToDouble(new decimal(reader.ReadSingle()))); case BinaryDataType.Float64: return(reader.ReadDouble()); case BinaryDataType.Int32: return((double)reader.ReadInt32()); case BinaryDataType.Int64: return((double)reader.ReadInt64()); default: throw new NotSupportedException("Data type not supported: " + binaryDataType.ToString()); } }
public static IParamContainer SetBinaryDataType( this IParamContainer pc, BinaryDataType binaryDataType) { switch (binaryDataType) { case BinaryDataType.Float32: return(pc.Set32BitFloat()); case BinaryDataType.Float64: return(pc.Set64BitFloat()); case BinaryDataType.Int32: return(pc.Set32BitInteger()); case BinaryDataType.Int64: return(pc.Set64BitInteger()); default: throw new NotSupportedException("Data type not supported: " + binaryDataType.ToString()); } }
private static void WriteValue(BinaryWriter writer, BinaryDataType binaryDataType, double value) { switch (binaryDataType) { case BinaryDataType.Float32: writer.Write((double)value); break; case BinaryDataType.Float64: writer.Write(value); break; case BinaryDataType.Int32: writer.Write((int)value); break; case BinaryDataType.Int64: writer.Write((long)value); break; default: throw new NotSupportedException("Data type not supported: " + binaryDataType.ToString()); } }
public BinaryDataAttribute(int index, int length = 0, BinaryDataType binaryDataType = BinaryDataType.MetaData) { Index = index; Length = length; BinaryDataType = binaryDataType; }
public string EncodeBase64(double[] values, BinaryDataCompressionType compressionType, BinaryDataType binaryDataType) { memoryStream.Position = 0; switch (compressionType) { case BinaryDataCompressionType.NoCompression: NoCompression(memoryStream, binaryDataType, values); break; case BinaryDataCompressionType.ZLib: ZLib(memoryStream, binaryDataType, values); break; default: throw new NotSupportedException("Compression type not supported: " + compressionType.ToString()); } memoryStream.Position = 0; return(Convert.ToBase64String(memoryStream.ToArray())); }
public virtual void VisitBinaryDataType(BinaryDataType binaryDataType) { DefaultVisit(binaryDataType); }
IEdmPrimitiveTypeReference IPrimitiveDataTypeVisitor <IEdmPrimitiveTypeReference> .Visit(BinaryDataType dataType) { IEdmPrimitiveType typeDefinition = this.GetEdmTypeDefinition(dataType); int?maxLength = null; if (dataType.HasFacet <MaxLengthFacet>()) { maxLength = dataType.GetFacet <MaxLengthFacet>().Value; } var typeReference = new EdmBinaryTypeReference( typeDefinition, dataType.IsNullable, false, maxLength); return(typeReference); }