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


C# OutputStream类代码示例

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


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

示例1: PpmdArchiveDecoder

        public PpmdArchiveDecoder(ImmutableArray<byte> settings, long length)
        {
            if (settings.IsDefault)
                throw new ArgumentNullException(nameof(settings));

            if (settings.Length != 5)
                throw new InvalidDataException();

            if (length < 0)
                throw new ArgumentOutOfRangeException(nameof(length));

            mOutput = new OutputStream(this);
            mLength = length;

            mSettingOrder = settings[0];
            if (mSettingOrder < PPMD.PPMD7_MIN_ORDER || mSettingOrder > PPMD.PPMD7_MAX_ORDER)
                throw new InvalidDataException();

            mSettingMemory = (uint)settings[1] | ((uint)settings[2] << 8) | ((uint)settings[3] << 16) | ((uint)settings[4] << 24);
            if (mSettingMemory < PPMD.PPMD7_MIN_MEM_SIZE || mSettingMemory > PPMD.PPMD7_MAX_MEM_SIZE)
                throw new InvalidDataException();

            mRangeDecoder = new PPMD.CPpmd7z_RangeDec();
            PPMD.Ppmd7z_RangeDec_CreateVTable(mRangeDecoder);
            mRangeDecoder.Stream = new PPMD.IByteIn { Read = x => ReadByte() };

            PPMD.Ppmd7_Construct(mState);
            if (!PPMD.Ppmd7_Alloc(mState, mSettingMemory, mAlloc))
                throw new OutOfMemoryException();
        }
开发者ID:modulexcite,项目名称:managed-lzma,代码行数:30,代码来源:PpmdDecoder.cs

示例2: WriteMoreDataThanCredited_OnlyCreditedDataWritten

        public void WriteMoreDataThanCredited_OnlyCreditedDataWritten()
        {
            using (Stream transport = new QueueStream())
            using (WriteQueue queue = new WriteQueue(transport))
            {
                Task pumpTask = queue.PumpToStreamAsync();
                OutputStream output = new OutputStream(1, Framing.Priority.Pri1, queue);
                FrameReader reader = new FrameReader(transport, false, CancellationToken.None);

                int dataLength = 0x1FFFF; // More than the 0x10000 default
                Task writeTask = output.WriteAsync(new byte[dataLength], 0, dataLength);
                Assert.False(writeTask.IsCompleted);

                Frame frame = reader.ReadFrameAsync().Result;
                Assert.False(frame.IsControl);
                Assert.Equal(0x10000, frame.FrameLength);

                Task<Frame> nextFrameTask = reader.ReadFrameAsync();
                Assert.False(nextFrameTask.IsCompleted);

                // Free up some space
                output.AddFlowControlCredit(10);

                frame = nextFrameTask.Result;
                Assert.False(frame.IsControl);
                Assert.Equal(10, frame.FrameLength);

                nextFrameTask = reader.ReadFrameAsync();
                Assert.False(nextFrameTask.IsCompleted);
            }
        }
开发者ID:Tratcher,项目名称:HTTP-SPEED-PLUS-MOBILITY,代码行数:31,代码来源:OutputStreamTests.cs

示例3: WriteMultipleData_OneFramePerWrite

        public void WriteMultipleData_OneFramePerWrite()
        {
            using (Stream transport = new QueueStream())
            using (WriteQueue queue = new WriteQueue(transport))
            {
                Task pumpTask = queue.PumpToStreamAsync();
                Stream output = new OutputStream(1, Framing.Priority.Pri1, queue);
                FrameReader reader = new FrameReader(transport, false, CancellationToken.None);

                int dataLength = 100;
                output.Write(new byte[dataLength], 0, dataLength);
                output.Write(new byte[dataLength * 2], 0, dataLength * 2);
                output.Write(new byte[dataLength * 3], 0, dataLength * 3);

                Frame frame = reader.ReadFrameAsync().Result;
                Assert.False(frame.IsControl);
                Assert.Equal(dataLength, frame.FrameLength);

                frame = reader.ReadFrameAsync().Result;
                Assert.False(frame.IsControl);
                Assert.Equal(dataLength * 2, frame.FrameLength);

                frame = reader.ReadFrameAsync().Result;
                Assert.False(frame.IsControl);
                Assert.Equal(dataLength * 3, frame.FrameLength);
            }
        }
开发者ID:Tratcher,项目名称:HTTP-SPEED-PLUS-MOBILITY,代码行数:27,代码来源:OutputStreamTests.cs

示例4: IndexingVariantContextWriter

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Requires({"name != null", "! ( location == null && output == null )", "! ( enableOnTheFlyIndexing && location == null )"}) protected IndexingVariantContextWriter(final String name, final File location, final OutputStream output, final net.sf.samtools.SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
		protected internal IndexingVariantContextWriter(string name, File location, OutputStream output, SAMSequenceDictionary refDict, bool enableOnTheFlyIndexing)
		{
			outputStream = output;
			this.name = name;
			this.refDict = refDict;

			if (enableOnTheFlyIndexing)
			{
				try
				{
					idxStream = new LittleEndianOutputStream(new FileOutputStream(Tribble.indexFile(location)));
					//System.out.println("Creating index on the fly for " + location);
					indexer = new DynamicIndexCreator(IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME);
					indexer.initialize(location, indexer.defaultBinSize());
					positionalOutputStream = new PositionalOutputStream(output);
					outputStream = positionalOutputStream;
				}
				catch (IOException ex)
				{
					// No matter what we keep going, since we don't care if we can't create the index file
					idxStream = null;
					indexer = null;
					positionalOutputStream = null;
				}
			}
		}
开发者ID:w3he,项目名称:Bio.VCF,代码行数:29,代码来源:IndexingVariantContextWriter.cs

示例5: VCFWriter

//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public VCFWriter(final File location, final OutputStream output, final net.sf.samtools.SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing, boolean doNotWriteGenotypes, final boolean allowMissingFieldsInHeader)
		public VCFWriter(File location, OutputStream output, SAMSequenceDictionary refDict, bool enableOnTheFlyIndexing, bool doNotWriteGenotypes, bool allowMissingFieldsInHeader) : base(writerName(location, output), location, output, refDict, enableOnTheFlyIndexing)
		{
			this.doNotWriteGenotypes = doNotWriteGenotypes;
			this.allowMissingFieldsInHeader = allowMissingFieldsInHeader;
			this.charset = Charset.forName("ISO-8859-1");
			this.writer = new OutputStreamWriter(lineBuffer, charset);
		}
开发者ID:w3he,项目名称:Bio.VCF,代码行数:9,代码来源:VCFWriter.cs

示例6: Init

        public void Init(IStreamHost host)
        {
            this.host = host;

            this.path = host.CreateParameter<string>("Path");

            this.to = host.CreateOutputStream<ImageStream>("Image Out");
        }
开发者ID:elliotwoods,项目名称:mrvux-libs,代码行数:8,代码来源:FileTest1.cs

示例7: Init

        public void Init(IStreamHost host)
        {
            this.host = host;
            this.testoutputstream = host.CreateOutputStream<DoubleStream>("Stream Out");
            this.to2 = host.CreateOutputStream<ImageStream>("Image Out");

            this.p1 = host.CreateParameter<double>("Param 1");
        }
开发者ID:elliotwoods,项目名称:mrvux-libs,代码行数:8,代码来源:SourceTest1.cs

示例8: Lzma2ArchiveDecoder

        public Lzma2ArchiveDecoder(ImmutableArray<byte> settings, long length)
        {
            System.Diagnostics.Debug.Assert(!settings.IsDefault && settings.Length == 1 && length >= 0);

            mDecoder = new LZMA2.Decoder(new LZMA2.DecoderSettings(settings[0]));
            mOutput = new OutputStream(this);
            mBuffer = new byte[4 << 10]; // TODO: We shouldn't have to use a buffer here. Let the input stream submit directly into the decoder.
            mLength = length;
        }
开发者ID:modulexcite,项目名称:managed-lzma,代码行数:9,代码来源:Lzma2Decoder.cs

示例9: Write

        public void Write(Action<Stream> output)
        {
            Action complete = () => { };
            var stream = new OutputStream((segment, continuation) =>
            {
                _response.BinaryWrite(segment);
                return true;
            }, complete);

            output(stream);
        }
开发者ID:uluhonolulu,项目名称:fubumvc,代码行数:11,代码来源:OwinHttpWriter.cs

示例10: Init

        public void Init(IStreamHost host)
        {
            this.host = host;
            this.testinputstream = host.CreateInputStream<IBaseStream>("Stream In");
            this.testoutputstream = host.CreateOutputStream<IBaseStream>("Stream Out");

            this.p1 = host.CreateParameter<double>("Param 1");
            this.p2 = host.CreateParameter<double>("Param 2");

            this.testoutdata = host.CreateOutput<double>("Out 1");
        }
开发者ID:elliotwoods,项目名称:mrvux-libs,代码行数:11,代码来源:ProcessorTest1.cs

示例11: CopyArchiveDecoder

        public CopyArchiveDecoder(ImmutableArray<byte> settings, long length)
        {
            if (settings.IsDefault)
                throw new ArgumentNullException(nameof(settings));

            if (!settings.IsEmpty)
                throw new InvalidDataException();

            if (length < 0)
                throw new ArgumentOutOfRangeException(nameof(length));

            mOutput = new OutputStream(this);
            mLength = length;
        }
开发者ID:modulexcite,项目名称:managed-lzma,代码行数:14,代码来源:CopyDecoder.cs

示例12: CopyStream

 public static void CopyStream(Stream inputStream, OutputStream os)
 {
     int buffer_size = 1024;
     try {
         byte[] bytes = new byte[buffer_size];
         for (;;) {
             int count = inputStream.Read (bytes, 0, buffer_size);
             if (count <= 0)
                 break;
             os.Write (bytes, 0, count);
         }
     } catch (Exception ex) {
     }
 }
开发者ID:MammothAU,项目名称:TwinTechsFormsLib,代码行数:14,代码来源:ImageLoader.cs

示例13: create

//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public static VariantContextWriter create(final java.io.File location, final java.io.OutputStream output, final net.sf.samtools.SAMSequenceDictionary refDict, final java.util.EnumSet<Options> options)
		public static VariantContextWriter create(File location, OutputStream output, SAMSequenceDictionary refDict, EnumSet<Options> options)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final boolean enableBCF = isBCFOutput(location, options);
			bool enableBCF = isBCFOutput(location, options);

			if (enableBCF)
			{
				return new BCF2Writer(location, output, refDict, options.contains(Options.INDEX_ON_THE_FLY), options.contains(Options.DO_NOT_WRITE_GENOTYPES));
			}
			else
			{
				return new VCFWriter(location, output, refDict, options.contains(Options.INDEX_ON_THE_FLY), options.contains(Options.DO_NOT_WRITE_GENOTYPES), options.contains(Options.ALLOW_MISSING_FIELDS_IN_HEADER));
			}
		}
开发者ID:w3he,项目名称:Bio.VCF,代码行数:17,代码来源:VariantContextWriterFactory.cs

示例14: write__

 public virtual void write__(OutputStream os__)
 {
     os__.startObject(null);
     writeImpl__(os__);
     os__.endObject();
 }
开发者ID:Radulfr,项目名称:zeroc-ice,代码行数:6,代码来源:Object.cs

示例15: ConnectedThread

			public ConnectedThread(BluetoothChatService chatService, BluetoothSocket socket, string socketType)
			{
				Log.D(TAG, "create ConnectedThread: " + socketType);
			    this.chatService = chatService;
			    mmSocket = socket;
				InputStream tmpIn = null;
				OutputStream tmpOut = null;

				// Get the BluetoothSocket input and output streams
				try
				{
					tmpIn = socket.GetInputStream();
					tmpOut = socket.GetOutputStream();
				}
				catch (IOException e)
				{
					Log.E(TAG, "temp sockets not created", e);
				}

				mmInStream = tmpIn;
				mmOutStream = tmpOut;
			}
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:22,代码来源:BluetoothChatService.cs


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