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


C# Sharpen.OutputStream类代码示例

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


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

示例1: close

 /// <exception cref="System.IO.IOException"/>
 public override void close()
 {
     if (_out != null)
     {
         if (_outPtr > 0)
         {
             _out.write(_outBuffer, 0, _outPtr);
             _outPtr = 0;
         }
         Sharpen.OutputStream @out = _out;
         _out = null;
         byte[] buf = _outBuffer;
         if (buf != null)
         {
             _outBuffer = null;
             _context.releaseWriteEncodingBuffer(buf);
         }
         @out.close();
         /* Let's 'flush' orphan surrogate, no matter what; but only
         * after cleanly closing everything else.
         */
         int code = _surrogate;
         _surrogate = 0;
         if (code > 0)
         {
             illegalSurrogate(code);
         }
     }
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:30,代码来源:UTF8Writer.cs

示例2: WriteField

		/// <exception cref="System.IO.IOException"></exception>
		private static void WriteField(MinimalField field, OutputStream @out)
		{
			WriteBytes(field.GetName(), @out);
			WriteBytes(FieldSep, @out);
			WriteBytes(field.GetBody(), @out);
			WriteBytes(CrLf, @out);
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:8,代码来源:HttpMultipart.cs

示例3: diff_Raw

 public static List<DiffEntry> diff_Raw(this API_NGit nGit, OutputStream outputStream)
 {
     var diff = nGit.Git.Diff();
     if (outputStream.notNull())
         diff.SetOutputStream(outputStream);
     return diff.Call().toList();
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:7,代码来源:Diff_ExtensionMethods.cs

示例4: Serialize

 /// <summary>Static method to serialize the metadata object.</summary>
 /// <remarks>
 /// Static method to serialize the metadata object. For each serialisation, a new XMPSerializer
 /// instance is created, either XMPSerializerRDF or XMPSerializerPlain so thats its possible to
 /// serialialize the same XMPMeta objects in two threads.
 /// </remarks>
 /// <param name="xmp">a metadata implementation object</param>
 /// <param name="out">the output stream to serialize to</param>
 /// <param name="options">serialization options, can be <code>null</code> for default.</param>
 /// <exception cref="Com.Adobe.Xmp.XMPException"/>
 public static void Serialize(XMPMetaImpl xmp, OutputStream @out, SerializeOptions options)
 {
     options = options != null ? options : new SerializeOptions();
     // sort the internal data model on demand
     if (options.GetSort())
     {
         xmp.Sort();
     }
     new XMPSerializerRDF().Serialize(xmp, @out, options);
 }
开发者ID:Sicos1977,项目名称:n-metadata-extractor,代码行数:20,代码来源:XMPSerializerHelper.cs

示例5: CopyStream

 /// <exception cref="System.IO.IOException"></exception>
 public static void CopyStream(InputStream @is, OutputStream os)
 {
     int n;
     byte[] buffer = new byte[16384];
     while ((n = @is.Read(buffer)) > -1)
     {
         os.Write(buffer, 0, n);
     }
     os.Close();
     @is.Close();
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:12,代码来源:StreamUtils.cs

示例6: UTF8Writer

 public UTF8Writer(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.OutputStream
     @out)
 {
     _context = ctxt;
     _out = @out;
     _outBuffer = ctxt.allocWriteEncodingBuffer();
     /* Max. expansion for a single char (in unmodified UTF-8) is
     * 4 bytes (or 3 depending on how you view it -- 4 when recombining
     * surrogate pairs)
     */
     _outBufferEnd = _outBuffer.Length - 4;
     _outPtr = 0;
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:13,代码来源:UTF8Writer.cs

示例7: URLConnection

		public URLConnection(Uri url) : base(url)
		{
			responseInputStream = new PipedInputStream();
			try
			{
				responseOutputStream = new PipedOutputStream((PipedInputStream)responseInputStream
					);
			}
			catch (IOException e)
			{
				Log.E(Database.Tag, "Exception creating piped output stream", e);
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:13,代码来源:URLConnection.cs

示例8: FormatMerge

		/// <summary>
		/// Formats the results of a merge of
		/// <see cref="NGit.Diff.RawText">NGit.Diff.RawText</see>
		/// objects in a Git
		/// conformant way. This method also assumes that the
		/// <see cref="NGit.Diff.RawText">NGit.Diff.RawText</see>
		/// objects
		/// being merged are line oriented files which use LF as delimiter. This
		/// method will also use LF to separate chunks and conflict metadata,
		/// therefore it fits only to texts that are LF-separated lines.
		/// </summary>
		/// <param name="out">the outputstream where to write the textual presentation</param>
		/// <param name="res">the merge result which should be presented</param>
		/// <param name="seqName">
		/// When a conflict is reported each conflicting range will get a
		/// name. This name is following the "<&lt;&lt;&lt;&lt;&lt;&lt; " or ">&gt;&gt;&gt;&gt;&gt;&gt; "
		/// conflict markers. The names for the sequences are given in
		/// this list
		/// </param>
		/// <param name="charsetName">
		/// the name of the characterSet used when writing conflict
		/// metadata
		/// </param>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		public virtual void FormatMerge(OutputStream @out, MergeResult<RawText> res, IList
			<string> seqName, string charsetName)
		{
			string lastConflictingName = null;
			// is set to non-null whenever we are
			// in a conflict
			bool threeWayMerge = (res.GetSequences().Count == 3);
			foreach (MergeChunk chunk in res)
			{
				RawText seq = res.GetSequences()[chunk.GetSequenceIndex()];
				if (lastConflictingName != null && chunk.GetConflictState() != MergeChunk.ConflictState
					.NEXT_CONFLICTING_RANGE)
				{
					// found the end of an conflict
					@out.Write(Sharpen.Runtime.GetBytesForString((">>>>>>> " + lastConflictingName + 
						"\n"), charsetName));
					lastConflictingName = null;
				}
				if (chunk.GetConflictState() == MergeChunk.ConflictState.FIRST_CONFLICTING_RANGE)
				{
					// found the start of an conflict
					@out.Write(Sharpen.Runtime.GetBytesForString(("<<<<<<< " + seqName[chunk.GetSequenceIndex
						()] + "\n"), charsetName));
					lastConflictingName = seqName[chunk.GetSequenceIndex()];
				}
				else
				{
					if (chunk.GetConflictState() == MergeChunk.ConflictState.NEXT_CONFLICTING_RANGE)
					{
						// found another conflicting chunk
						lastConflictingName = seqName[chunk.GetSequenceIndex()];
						@out.Write(Sharpen.Runtime.GetBytesForString((threeWayMerge ? "=======\n" : "======= "
							 + lastConflictingName + "\n"), charsetName));
					}
				}
				// the lines with conflict-metadata are written. Now write the chunk
				for (int i = chunk.GetBegin(); i < chunk.GetEnd(); i++)
				{
					seq.WriteLine(@out, i);
					@out.Write('\n');
				}
			}
			// one possible leftover: if the merge result ended with a conflict we
			// have to close the last conflict here
			if (lastConflictingName != null)
			{
				@out.Write(Sharpen.Runtime.GetBytesForString((">>>>>>> " + lastConflictingName + 
					"\n"), charsetName));
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:74,代码来源:MergeFormatter.cs

示例9: WriteTo

		/// <exception cref="System.IO.IOException"></exception>
		public override void WriteTo(OutputStream @out)
		{
			if (@out == null)
			{
				throw new ArgumentException("Output stream may not be null");
			}
			try
			{
				byte[] tmp = new byte[4096];
				int l;
				while ((l = [email protected](tmp)) != -1)
				{
					@out.Write(tmp, 0, l);
				}
				@out.Flush();
			}
			finally
			{
				[email protected]();
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:22,代码来源:InputStreamBody.cs

示例10: BufferedOutputStream

 public BufferedOutputStream(OutputStream outs)
 {
     base.Wrapped = new BufferedStream (outs.GetWrappedStream ());
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:4,代码来源:BufferedOutputStream.cs

示例11: WrappedSystemStream

 public WrappedSystemStream(OutputStream ost)
 {
     this.ost = ost;
 }
开发者ID:jordivicedo,项目名称:NBoilerpipe,代码行数:4,代码来源:WrappedSystemStream.cs

示例12: CountOutputStream

 /// <summary>Constructor with providing the output stream to decorate.</summary>
 /// <param name="out">an <code>OutputStream</code></param>
 internal CountOutputStream(OutputStream @out)
 {
     [email protected] = @out;
 }
开发者ID:Sicos1977,项目名称:n-metadata-extractor,代码行数:6,代码来源:CountOutputStream.cs

示例13: FormatIndexLine

		// The hunk header is not taken into account for patch id calculation
		/// <exception cref="System.IO.IOException"></exception>
		protected internal override void FormatIndexLine(OutputStream o, DiffEntry ent)
		{
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:5,代码来源:PatchIdDiffFormatter.cs

示例14: Connect

		/// <exception cref="NSch.JSchException"></exception>
		public virtual void Connect(int connectTimeout)
		{
			if (isConnected)
			{
				throw new JSchException("session is already connected");
			}
			io = new IO();
			if (random == null)
			{
				try
				{
					Type c = Sharpen.Runtime.GetType(GetConfig("random"));
					random = (Random)(System.Activator.CreateInstance(c));
				}
				catch (Exception e)
				{
					throw new JSchException(e.ToString(), e);
				}
			}
			Packet.SetRandom(random);
			if (JSch.GetLogger().IsEnabled(Logger.INFO))
			{
				JSch.GetLogger().Log(Logger.INFO, "Connecting to " + host + " port " + port);
			}
			try
			{
				int i;
				int j;
				if (proxy == null)
				{
					InputStream @in;
					OutputStream @out;
					if (socket_factory == null)
					{
						socket = Util.CreateSocket(host, port, connectTimeout);
						@in = socket.GetInputStream();
						@out = socket.GetOutputStream();
					}
					else
					{
						socket = socket_factory.CreateSocket(host, port);
						@in = socket_factory.GetInputStream(socket);
						@out = socket_factory.GetOutputStream(socket);
					}
					//if(timeout>0){ socket.setSoTimeout(timeout); }
					socket.NoDelay = true;
					io.SetInputStream(@in);
					io.SetOutputStream(@out);
				}
				else
				{
					lock (proxy)
					{
						proxy.Connect(socket_factory, host, port, connectTimeout);
						io.SetInputStream(proxy.GetInputStream());
						io.SetOutputStream(proxy.GetOutputStream());
						socket = proxy.GetSocket();
					}
				}
				if (connectTimeout > 0 && socket != null)
				{
					socket.ReceiveTimeout = connectTimeout;
				}
				isConnected = true;
				if (JSch.GetLogger().IsEnabled(Logger.INFO))
				{
					JSch.GetLogger().Log(Logger.INFO, "Connection established");
				}
				jsch.AddSession(this);
				{
					// Some Cisco devices will miss to read '\n' if it is sent separately.
					byte[] foo = new byte[V_C.Length + 1];
					System.Array.Copy(V_C, 0, foo, 0, V_C.Length);
					foo[foo.Length - 1] = unchecked((byte)(byte)('\n'));
					io.Put(foo, 0, foo.Length);
				}
				while (true)
				{
					i = 0;
					j = 0;
					while (i < buf.buffer.Length)
					{
						j = io.GetByte();
						if (j < 0)
						{
							break;
						}
						buf.buffer[i] = unchecked((byte)j);
						i++;
						if (j == 10)
						{
							break;
						}
					}
					if (j < 0)
					{
						throw new JSchException("connection is closed by foreign host");
					}
					if (buf.buffer[i - 1] == 10)
//.........这里部分代码省略.........
开发者ID:yayanyang,项目名称:monodevelop,代码行数:101,代码来源:Session.cs

示例15: Receive

        /// <summary>Execute the receive task on the socket.</summary>
        /// <remarks>Execute the receive task on the socket.</remarks>
        /// <param name="input">
        /// raw input to read client commands and pack data from. Caller
        /// must ensure the input is buffered, otherwise read performance
        /// may suffer.
        /// </param>
        /// <param name="output">
        /// response back to the Git network client. Caller must ensure
        /// the output is buffered, otherwise write performance may
        /// suffer.
        /// </param>
        /// <param name="messages">
        /// secondary "notice" channel to send additional messages out
        /// through. When run over SSH this should be tied back to the
        /// standard error channel of the command execution. For most
        /// other network connections this should be null.
        /// </param>
        /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
        public virtual void Receive(InputStream input, OutputStream output, OutputStream 
			messages)
        {
            Init(input, output, messages);
            try
            {
                Service();
            }
            finally
            {
                try
                {
                    Close();
                }
                finally
                {
                    Release();
                }
            }
        }
开发者ID:ninjaferret,项目名称:ngit,代码行数:39,代码来源:ReceivePack.cs


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