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

C# Sharpen.InputStream类代码示例

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

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



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

示例1: PackIndexV1

		/// <exception cref="NGit.Errors.CorruptObjectException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		internal PackIndexV1(InputStream fd, byte[] hdr)
		{
			byte[] fanoutTable = new byte[IDX_HDR_LEN];
			System.Array.Copy(hdr, 0, fanoutTable, 0, hdr.Length);
			IOUtil.ReadFully(fd, fanoutTable, hdr.Length, IDX_HDR_LEN - hdr.Length);
			idxHeader = new long[256];
			// really unsigned 32-bit...
			for (int k = 0; k < idxHeader.Length; k++)
			{
				idxHeader[k] = NB.DecodeUInt32(fanoutTable, k * 4);
			}
			idxdata = new byte[idxHeader.Length][];
			for (int k_1 = 0; k_1 < idxHeader.Length; k_1++)
			{
				int n;
				if (k_1 == 0)
				{
					n = (int)(idxHeader[k_1]);
				}
				else
				{
					n = (int)(idxHeader[k_1] - idxHeader[k_1 - 1]);
				}
				if (n > 0)
				{
					idxdata[k_1] = new byte[n * (Constants.OBJECT_ID_LENGTH + 4)];
					IOUtil.ReadFully(fd, idxdata[k_1], 0, idxdata[k_1].Length);
				}
			}
			objectCnt = idxHeader[255];
			packChecksum = new byte[20];
			IOUtil.ReadFully(fd, packChecksum, 0, packChecksum.Length);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:35,代码来源:PackIndexV1.cs


示例2: Attachment

		internal Attachment(InputStream contentStream, string contentType)
		{
			this.body = contentStream;
			metadata = new Dictionary<string, object>();
			metadata.Put("content_type", contentType);
			metadata.Put("follows", true);
			this.gzipped = false;
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:8,代码来源:Attachment.cs


示例3: StreamReader

		public StreamReader(InputStream stream)
		{
			if (stream == null)
			{
				throw new ArgumentNullException();
			}
			_stream = stream;
		}
开发者ID:renaud91,项目名称:n-metadata-extractor,代码行数:8,代码来源:StreamReader.cs


示例4: MergedStream

 public MergedStream(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.InputStream
     @in, byte[] buf, int start, int end)
 {
     _ctxt = ctxt;
     _in = @in;
     _b = buf;
     _ptr = start;
     _end = end;
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:9,代码来源:MergedStream.cs


示例5: ReadMetadata

		public static Com.Drew.Metadata.Metadata ReadMetadata(InputStream inputStream)
		{
			// TIFF processing requires random access, as directories can be scattered throughout the byte sequence.
			// InputStream does not support seeking backwards, and so is not a viable option for TIFF processing.
			// We use RandomAccessStreamReader, which buffers data from the stream as we seek forward.
			Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
			new ExifReader().ExtractTiff(new RandomAccessStreamReader(inputStream), metadata);
			return metadata;
		}
开发者ID:renaud91,项目名称:n-metadata-extractor,代码行数:9,代码来源:TiffMetadataReader.cs


示例6: ZInputStream

		public ZInputStream(InputStream @in, int level) : base(@in)
		{
			[email protected] = @in;
			z.DeflateInit(level);
			compress = true;
			z.next_in = buf;
			z.next_in_index = 0;
			z.avail_in = 0;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:ZInputStream.cs


示例7: close

 /*
 /**********************************************************
 /* Public API
 /**********************************************************
 */
 /// <exception cref="System.IO.IOException"/>
 public override void close()
 {
     Sharpen.InputStream @in = _in;
     if (@in != null)
     {
         _in = null;
         freeBuffers();
         @in.close();
     }
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:16,代码来源:UTF32Reader.cs


示例8: InputStreamBody

 public InputStreamBody(InputStream @in, string mimeType, string filename) : base(
     mimeType)
 {
     if (@in == null)
     {
         throw new ArgumentException("Input stream may not be null");
     }
     [email protected] = @in;
     this.filename = filename;
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:10,代码来源:InputStreamBody.cs


示例9: DataFormatMatcher

 protected internal DataFormatMatcher(Sharpen.InputStream @in, byte[] buffered, int
     bufferedStart, int bufferedLength, com.fasterxml.jackson.core.JsonFactory match
     , com.fasterxml.jackson.core.format.MatchStrength strength)
 {
     _originalStream = @in;
     _bufferedData = buffered;
     _bufferedStart = bufferedStart;
     _bufferedLength = bufferedLength;
     _match = match;
     _matchStrength = strength;
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:11,代码来源:DataFormatMatcher.cs


示例10: 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


示例11: CopyStreamToFile

 /// <exception cref="System.IO.IOException"></exception>
 public static void CopyStreamToFile(InputStream @is, FilePath file)
 {
     OutputStream os = new FileOutputStream(file);
     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,代码行数:13,代码来源:StreamUtils.cs


示例12: 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


示例13: Std

 /// <summary>
 /// Constructor used when content to check is available via
 /// input stream and must be read.
 /// </summary>
 public Std(Sharpen.InputStream @in, byte[] buffer)
 {
     /*
     /**********************************************************
     /* Standard implementation
     /**********************************************************
     */
     _in = @in;
     _buffer = buffer;
     _bufferedStart = 0;
     _ptr = 0;
     _bufferedEnd = 0;
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:17,代码来源:InputAccessor.cs


示例14: Read

		/// <exception cref="System.IO.IOException"></exception>
		public static byte[] Read(InputStream @is)
		{
			int initialCapacity = 1024;
			ByteArrayBuffer byteArrayBuffer = new ByteArrayBuffer(initialCapacity);
			byte[] bytes = new byte[512];
			int offset = 0;
			int numRead = 0;
			while ((numRead = @is.Read(bytes, offset, bytes.Length - offset)) >= 0)
			{
				byteArrayBuffer.Append(bytes, 0, numRead);
				offset += numRead;
			}
			return byteArrayBuffer.ToByteArray();
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:15,代码来源:TextUtils.cs


示例15: UTF32Reader

 public UTF32Reader(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.InputStream
     @in, byte[] buf, int ptr, int len, bool isBigEndian)
 {
     /*
     /**********************************************************
     /* Life-cycle
     /**********************************************************
     */
     _context = ctxt;
     _in = @in;
     _buffer = buf;
     _ptr = ptr;
     _length = len;
     _bigEndian = isBigEndian;
     _managedBuffers = (@in != null);
 }
开发者ID:davidraleigh,项目名称:jackson-parser-cs,代码行数:16,代码来源:UTF32Reader.cs


示例16: ByteBuffer

 /// <summary>Loads the stream into a buffer.</summary>
 /// <param name="in">an InputStream</param>
 /// <exception cref="System.IO.IOException">If the stream cannot be read.</exception>
 public ByteBuffer(InputStream @in)
 {
     // load stream into buffer
     int chunk = 16384;
     this.length = 0;
     this.buffer = new sbyte[chunk];
     int read;
     while ((read = @in.Read(this.buffer, this.length, chunk)) > 0)
     {
         this.length += read;
         if (read == chunk)
         {
             EnsureCapacity(length + chunk);
         }
         else
         {
             break;
         }
     }
 }
开发者ID:Sicos1977,项目名称:n-metadata-extractor,代码行数:23,代码来源:ByteBuffer.cs


示例17: Load

        public static void Load(this Hashtable props, InputStream stream)
        {
            using (var reader = new InputStreamReader(stream, Encoding.UTF8))
            {
                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    if (!String.IsNullOrWhiteSpace(line) && !line.StartsWith("#"))
                    {
                        var parts = line.Split('=');
                        if (parts.Length != 2)
                            throw new InvalidOperationException("Properties must be key value pairs separated by an '='.");

                        if (!props.ContainsKey(parts[0]))
                            props.Add(parts[0], parts[1]);
                        else
                            props[parts[0]] = parts[1];
                    }
                }
            }
        }
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:21,代码来源:ExtensionMethods.cs


示例18: BundleFetchConnection

		/// <exception cref="NGit.Errors.TransportException"></exception>
		internal BundleFetchConnection(NGit.Transport.Transport transportBundle, InputStream
			 src)
		{
			transport = transportBundle;
			bin = new BufferedInputStream(src);
			try
			{
				switch (ReadSignature())
				{
					case 2:
					{
						ReadBundleV2();
						break;
					}

					default:
					{
						throw new TransportException(transport.uri, JGitText.Get().notABundle);
					}
				}
			}
			catch (TransportException err)
			{
				Close();
				throw;
			}
			catch (IOException err)
			{
				Close();
				throw new TransportException(transport.uri, err.Message, err);
			}
			catch (RuntimeException err)
			{
				Close();
				throw new TransportException(transport.uri, err.Message, err);
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:38,代码来源:BundleFetchConnection.cs


示例19: Post

        /// <exception cref="EU.Europa.EC.Markt.Dss.CannotFetchDataException"></exception>
        public Stream Post(string URL, InputStream content)
        {
            try
            {
                LOG.Info("Post data to url " + URL);      

                byte[] data = Streams.ReadAll(content);

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
                request.Timeout = TimeOut;
                request.Method = "POST";
                request.ContentLength = data.Length;

                if (ContentType != null)
                {
                    request.ContentType = ContentType;
                }

                if (Accept != null)
                {
                    request.Accept = Accept;
                }

                Stream dataStream = request.GetRequestStream();
                dataStream.Write(data, 0, data.Length);
                dataStream.Close();

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                dataStream = response.GetResponseStream();

                return dataStream;
            }
            catch (IOException ex)
            {
                throw new CannotFetchDataException(ex, URL);
            }
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:38,代码来源:NetHttpDataLoader.cs


示例20: Insert

		/// <exception cref="System.IO.IOException"></exception>
		public override ObjectId Insert(int type, long len, InputStream @is)
		{
			MessageDigest md = Digest();
			FilePath tmp = ToTemp(md, type, len, @is);
			ObjectId id = ObjectId.FromRaw(md.Digest());
			switch (db.InsertUnpackedObject(tmp, id, false))
			{
				case FileObjectDatabase.InsertLooseObjectResult.INSERTED:
				case FileObjectDatabase.InsertLooseObjectResult.EXISTS_PACKED:
				case FileObjectDatabase.InsertLooseObjectResult.EXISTS_LOOSE:
				{
					return id;
				}

				case FileObjectDatabase.InsertLooseObjectResult.FAILURE:
				default:
				{
					break;
					break;
				}
			}
			FilePath dst = db.FileFor(id);
			throw new ObjectWritingException("Unable to create new object: " + dst);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:25,代码来源:ObjectDirectoryInserter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Sharpen.OutputStream类代码示例发布时间:2022-05-26
下一篇:
C# Sharpen.FilePath类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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