当前位置: 首页>>代码示例>>C#>>正文


C# BigEndianBinaryReader类代码示例

本文整理汇总了C#中BigEndianBinaryReader的典型用法代码示例。如果您正苦于以下问题:C# BigEndianBinaryReader类的具体用法?C# BigEndianBinaryReader怎么用?C# BigEndianBinaryReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BigEndianBinaryReader类属于命名空间,在下文中一共展示了BigEndianBinaryReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadMBRs

        public IEnumerable<MBRInfo> ReadMBRs()
        {
            ThrowIfDisposed();

            BigEndianBinaryReader NewReader = new BigEndianBinaryReader(m_StreamProviderRegistry[StreamTypes.Shape].OpenRead());
            return m_ShapeHandler.ReadMBRs(NewReader);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:ShapeReader.cs

示例2: VerticalMetric

		public VerticalMetric(BigEndianBinaryReader reader)
		{
			Contract.Requires(reader != null);

			AdvanceHeight = reader.ReadUInt16();
			TopSideBearings = reader.ReadInt16();
		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:7,代码来源:vMetric.cs

示例3: Read

        /// <summary>
        /// Reads a stream and converts the shapefile record to an equilivant geometry object.
        /// </summary>
        /// <param name="file">The stream to read.</param>
        /// <param name="geometryFactory">The geometry factory to use when making the object.</param>
        /// <returns>The Geometry object that represents the shape file record.</returns>
        public override IGeometry Read(BigEndianBinaryReader file, IGeometryFactory geometryFactory)
        {
            int shapeTypeNum = file.ReadInt32();

            type = (ShapeGeometryType) Enum.Parse(typeof(ShapeGeometryType), shapeTypeNum.ToString());
            if (type == ShapeGeometryType.NullShape)
                return geometryFactory.CreateMultiPoint(new IPoint[] { });
            
            if (!(type == ShapeGeometryType.MultiPoint  || type == ShapeGeometryType.MultiPointM ||
                  type == ShapeGeometryType.MultiPointZ || type == ShapeGeometryType.MultiPointZM))	
                throw new ShapefileException("Attempting to load a non-multipoint as multipoint.");

            // Read and for now ignore bounds.
            int bblength = GetBoundingBoxLength();
            bbox = new double[bblength];
            for (; bbindex < 4; bbindex++)
            {
                double d = file.ReadDouble();
                bbox[bbindex] = d;
            }

            // Read points
            int numPoints = file.ReadInt32();
            IPoint[] points = new IPoint[numPoints];
            for (int i = 0; i < numPoints; i++)
            {
                double x = file.ReadDouble();
                double y = file.ReadDouble();
                IPoint point = geometryFactory.CreatePoint(new Coordinate(x, y));                
                points[i] = point;
            }
            geom = geometryFactory.CreateMultiPoint(points);
            GrabZMValues(file);
            return geom;
        }        
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:41,代码来源:MultiPointHandler.cs

示例4: Read

        /// <summary>
        /// Reads a stream and converts the shapefile record to an equilivent geometry object.
        /// </summary>
        /// <param name="file">The stream to read.</param>
        /// <param name="totalRecordLength">Total length of the record we are about to read</param>
        /// <param name="factory">The geometry factory to use when making the object.</param>
        /// <returns>The Geometry object that represents the shape file record.</returns>
        public override IGeometry Read(BigEndianBinaryReader file, int totalRecordLength, IGeometryFactory factory)
        {
            int totalRead = 0;
            ShapeGeometryType type = (ShapeGeometryType)ReadInt32(file, totalRecordLength, ref totalRead);
            //type = (ShapeGeometryType) EnumUtility.Parse(typeof (ShapeGeometryType), shapeTypeNum.ToString());
            if (type == ShapeGeometryType.NullShape)
                return factory.CreatePoint((Coordinate)null);

            if (type != ShapeType)
                throw new ShapefileException(string.Format("Encountered a '{0}' instead of a  '{1}'", type, ShapeType));

            CoordinateBuffer buffer = new CoordinateBuffer(1, NoDataBorderValue, true);
            IPrecisionModel precisionModel = factory.PrecisionModel;

            double x = precisionModel.MakePrecise(ReadDouble(file, totalRecordLength, ref totalRead));
            double y = precisionModel.MakePrecise(ReadDouble(file, totalRecordLength, ref totalRead));

            double? z = null, m = null;
            
            // Trond Benum: Let's read optional Z and M values                                
            if (HasZValue() && totalRead < totalRecordLength)
                z = ReadDouble(file, totalRecordLength, ref totalRead);

            if ((HasMValue() || HasZValue()) &&
                (totalRead < totalRecordLength))
                m = ReadDouble(file, totalRecordLength, ref totalRead);

            buffer.AddCoordinate(x, y, z, m);
            return factory.CreatePoint(buffer.ToSequence(factory.CoordinateSequenceFactory));
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:37,代码来源:PointHandler.cs

示例5: FromStream

        public static Partition FromStream(BigEndianBinaryReader stream)
        {
            var partition = new Partition
            {
                ErrorCode = stream.ReadInt16(),
                PartitionId = stream.ReadInt32(),
                LeaderId = stream.ReadInt32(),
                Replicas = new List<int>(),
                Isrs = new List<int>()
            };

            var numReplicas = stream.ReadInt32();
            for (int i = 0; i < numReplicas; i++)
            {
                partition.Replicas.Add(stream.ReadInt32());
            }

            var numIsr = stream.ReadInt32();
            for (int i = 0; i < numIsr; i++)
            {
                partition.Isrs.Add(stream.ReadInt32());
            }

            return partition;
        }
开发者ID:BDeus,项目名称:KafkaNetClient,代码行数:25,代码来源:Topic.cs

示例6: Read

        /// <summary>
        /// Reads a stream and converts the shapefile record to an equilivent geometry object.
        /// </summary>
        /// <param name="file">The stream to read.</param>
        /// <param name="geometryFactory">The geometry factory to use when making the object.</param>
        /// <returns>The Geometry object that represents the shape file record.</returns>
        public override IGeometry Read(BigEndianBinaryReader file, IGeometryFactory geometryFactory)
        {
            int shapeTypeNum = file.ReadInt32();
            type = (ShapeGeometryType) Enum.Parse(typeof (ShapeGeometryType), shapeTypeNum.ToString());
            if (type == ShapeGeometryType.NullShape)
            {
                ICoordinate emptyCoordinate = null;
                return geometryFactory.CreatePoint(emptyCoordinate);
            }

            if (!(type == ShapeGeometryType.Point  || type == ShapeGeometryType.PointM ||
                  type == ShapeGeometryType.PointZ || type == ShapeGeometryType.PointZM))
                throw new ShapefileException("Attempting to load a point as point.");		    

            double x = file.ReadDouble();
            double y = file.ReadDouble();		    
            ICoordinate external = new Coordinate(x,y);			
            geometryFactory.PrecisionModel.MakePrecise(external);
            IPoint point = geometryFactory.CreatePoint(external);
            if (HasZValue() || HasMValue())
            {
                IDictionary<ShapeGeometryType, double> data = new Dictionary<ShapeGeometryType, double>(2);
                if (HasZValue())
                    GetZValue(file, data);
                if (HasMValue())
                    GetMValue(file, data);
                // point.UserData = data;
            }
            return point;
        }
开发者ID:diegowald,项目名称:intellitrack,代码行数:36,代码来源:PointHandler.cs

示例7: EncodingRecord

		internal EncodingRecord(BigEndianBinaryReader reader)
		{
			Contract.Requires(reader != null);

			ushort platformID = reader.ReadUInt16();
			ushort encodingID = reader.ReadUInt16();

		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:8,代码来源:EncodingRecord.cs

示例8: CmapTable

		internal CmapTable(BigEndianBinaryReader reader)
		{
			Contract.Requires(reader != null);
			Contract.Requires(reader.BaseStream.CanSeek);

			ushort version = reader.ReadUInt16();
			ushort numTables = reader.ReadUInt16();
		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:8,代码来源:CmapTable.cs

示例9: FromStream

 public static Broker FromStream(BigEndianBinaryReader stream)
 {
     return new Broker
         {
             BrokerId = stream.ReadInt32(),
             Host = stream.ReadInt16String(),
             Port = stream.ReadInt32()
         };
 }
开发者ID:jsifantu,项目名称:kafka-net,代码行数:9,代码来源:Broker.cs

示例10: ReadBundle

        public HgBundle ReadBundle(Stream stream)
        {   
            var uncompressedStream = GetUncompressedStream(stream);
            var binaryReader = new BigEndianBinaryReader(new BufferedStream(new NonClosingStreamWrapper(uncompressedStream), 1024 * 1024));
            var changelog = ReadBundleGroup(binaryReader);
            var manifest = ReadBundleGroup(binaryReader);
            var files = ReadBundleFiles(binaryReader); new List<HgBundleFile>();

            return new HgBundle(changelog, manifest, files);
        }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:10,代码来源:HgBundleReader.cs

示例11: read

 internal void read(BigEndianBinaryReader reader)
 {
     width = reader.ReadInt32();
     height = reader.ReadInt32();
     bitdepth = reader.ReadByte();
     colortype = (ColorType)reader.ReadByte();
     method = reader.ReadByte();
     filter = reader.ReadByte();
     interlace = reader.ReadByte();
 }
开发者ID:Bananattack,项目名称:ankh,代码行数:10,代码来源:png.cs

示例12: ReadDouble

        /// <summary>
        /// Read a double from the stream.<br/>Tracks how many words (1 word = 2 bytes) we have read and than we do not over read.
        /// </summary>
        /// <param name="file">The reader to use</param>
        /// <param name="totalRecordLength">The total number of words (1 word = 2 bytes) this record has</param>
        /// <param name="totalRead">A word counter</param>
        /// <returns>The value read</returns>
        protected double ReadDouble(BigEndianBinaryReader file, int totalRecordLength, ref int totalRead)
        {
            var newRead = totalRead + 4;
            if (newRead > totalRecordLength)
                throw new Exception("End of data encountered while reading double");

            // track how many bytes we have read to know if we have optional values at the end of the record or not
            totalRead = newRead; 
            return file.ReadDouble();
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:17,代码来源:ShapeHandler.cs

示例13: UInt32Tests

        public void UInt32Tests(UInt32 expectedValue, Byte[] givenBytes)
        {
            // arrange
            var binaryReader = new BigEndianBinaryReader(givenBytes);

            // act
            var actualValue = binaryReader.ReadUInt32();

            // assert
            Assert.That(expectedValue, Is.EqualTo(actualValue));
        }
开发者ID:BDeus,项目名称:KafkaNetClient,代码行数:11,代码来源:BigEndianBinaryReaderTests.cs

示例14: Int32Tests

        public void Int32Tests(Int32 expectedValue, Byte[] givenBytes)
        {
            // arrange
            var memoryStream = new MemoryStream(givenBytes);
            var binaryReader = new BigEndianBinaryReader(memoryStream);

            // act
            var actualValue = binaryReader.ReadInt32();

            // assert
            Assert.Equal(expectedValue, actualValue);
        }
开发者ID:rudygt,项目名称:dot-kafka,代码行数:12,代码来源:BigEndianBinaryReaderTests.cs

示例15: CharArrayTests

        public void CharArrayTests(Char[] expectedValue, Byte[] givenBytes)
        {
            // arrange
            var memoryStream = new MemoryStream(givenBytes);
            var binaryReader = new BigEndianBinaryReader(memoryStream);

            // act
            var actualValue = binaryReader.ReadChars(givenBytes.Length);

            // assert
            Assert.Equal(expectedValue, actualValue);
        }
开发者ID:rudygt,项目名称:dot-kafka,代码行数:12,代码来源:BigEndianBinaryReaderTests.cs


注:本文中的BigEndianBinaryReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。