• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OutputStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get

		public void get(String src, OutputStream dst,
			SftpProgressMonitor monitor, int mode, long skip)
		{
			//throws SftpException{
			//try
			//{
				src=remoteAbsolutePath(src);
				Vector v=glob_remote(src);
				if(v.size()!=1)
				{
					throw new SftpException(SSH_FX_FAILURE, v.toString());
				}
				src=(String)(v.elementAt(0));

				if(monitor!=null)
				{
					SftpATTRS attr=_stat(src);
					monitor.init(SftpProgressMonitor.GET, src, "??", attr.getSize());
					if(mode==RESUME)
					{
						monitor.count(skip);
					}
				}
				_get(src, dst, monitor, mode, skip);
			//}
			//catch(Exception e)
			//{
			//	if(e is SftpException) throw (SftpException)e;
			//	throw new SftpException(SSH_FX_FAILURE, "");
			//}
		}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:31,代码来源:ChannelSftp.cs


示例17: writeImpl__

 protected virtual void writeImpl__(OutputStream os__)
 {
 }
开发者ID:Crysty-Yui,项目名称:ice,代码行数:3,代码来源:Object.cs


示例18: Create

        internal static NetFxToWinRtStreamAdapter Create(Stream stream)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            StreamReadOperationOptimization readOptimization = StreamReadOperationOptimization.AbstractStream;
            if (stream.CanRead)
                readOptimization = DetermineStreamReadOptimization(stream);

            NetFxToWinRtStreamAdapter adapter;

            if (stream.CanSeek)
                adapter = new RandomAccessStream(stream, readOptimization);

            else if (stream.CanRead && stream.CanWrite)
                adapter = new InputOutputStream(stream, readOptimization);

            else if (stream.CanRead)
                adapter = new InputStream(stream, readOptimization);

            else if (stream.CanWrite)
                adapter = new OutputStream(stream, readOptimization);

            else
                throw new ArgumentException(SR.Argument_NotSufficientCapabilitiesToConvertToWinRtStream);

            return adapter;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:28,代码来源:NetFxToWinRtStreamAdapter.cs


示例19: BufferedOutputStream

 public BufferedOutputStream(OutputStream arg0, int arg1)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("(Ljava/io/OutputStream;I)V", arg0, arg1);
 }
开发者ID:bcrusu,项目名称:jvm4csharp,代码行数:5,代码来源:BufferedOutputStream.gen.cs


示例20: OutputHandlerEventArgs

 public OutputHandlerEventArgs(string line, OutputStream stream)
 {
     Line = line;
     OutputStream = stream;
 }
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-powershell,代码行数:5,代码来源:ProcessUtils.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OutputType类代码示例发布时间:2022-05-24
下一篇:
C# OutputPort类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap