本文整理汇总了C#中Sharpen.InputStream类的典型用法代码示例。如果您正苦于以下问题:C# InputStream类的具体用法?C# InputStream怎么用?C# InputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputStream类属于Sharpen命名空间,在下文中一共展示了InputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例3: StreamReader
public StreamReader(InputStream stream)
{
if (stream == null)
{
throw new ArgumentNullException();
}
_stream = stream;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}