本文整理汇总了C#中IInputStream类的典型用法代码示例。如果您正苦于以下问题:C# IInputStream类的具体用法?C# IInputStream怎么用?C# IInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInputStream类属于命名空间,在下文中一共展示了IInputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InputStreamReader
public InputStreamReader(IInputStream stream, uint bufferSize)
{
_reader = new DataReader(stream);
_reader.InputStreamOptions = InputStreamOptions.Partial;
_bufferSize = bufferSize;
}
示例2: PushAttachmentData
public PushAttachmentData(String contentType, IInputStream data, ulong dataSize, byte[] key)
{
this.contentType = contentType;
this.data = data;
this.dataSize = dataSize;
this.key = key;
}
示例3: ReadStringFromInputStream
public bool ReadStringFromInputStream(IInputStream inputStream, List<string> messages, out string s)
{
var bytesCollection = new List<byte[]>();
var bytes = new byte[Environment.SystemPageSize];
while (true)
{
var bytesRead = inputStream.Read(bytes, _timeout);
if (bytesRead <= 0) break;
var bytesCopy = new byte[bytesRead];
Buffer.BlockCopy(bytes, 0, bytesCopy, 0, bytesRead);
bytesCollection.Add(bytesCopy);
}
var bytesCount = bytesCollection.Sum(bytesChunk => bytesChunk.Length);
bytes = new byte[bytesCount];
var offset = 0;
foreach (var bytesChunk in bytesCollection)
{
Buffer.BlockCopy(bytesChunk, 0, bytes, offset, bytesChunk.Length);
offset += bytesChunk.Length;
}
try
{
s = _encoding.GetString(bytes);
}
catch (Exception e)
{
messages.Add(e.ToString());
s = null;
return false;
}
return true;
}
示例4: DataReader
public DataReader (IInputStream inputStream)
{
if (inputStream == null)
throw new ArgumentNullException ("inputStream");
throw new NotImplementedException();
}
示例5: LoadTileSetAsync
private static async Task<TileSet> LoadTileSetAsync(IInputStream stream)
{
using (var reader = new StreamReader(stream.AsStreamForRead()))
{
return JsonConvert.DeserializeObject<TileSet>(await reader.ReadToEndAsync());
}
}
示例6: Reader
internal Reader(
IInputStream stream,
files.File file
)
{
this.parser = new FileParser(stream, file);
}
示例7: ProtectStreamToStream
/// <summary>
/// Encrypt an input stream and output to another stream
/// </summary>
/// <param name="inStream"></param>
/// <param name="outStream"></param>
/// <param name="userDescriptor"></param>
/// <returns></returns>
public static async Task ProtectStreamToStream(IInputStream inStream, IOutputStream outStream, string userDescriptor)
{
// Create a DataProtectionProvider object for the specified descriptor.
DataProtectionProvider Provider = new DataProtectionProvider(userDescriptor);
await Provider.ProtectStreamAsync(inStream, outStream);
}
示例8: LengthMarkedBufferedInputStream
public LengthMarkedBufferedInputStream(IInputStream input)
{
this.input = input;
buf = new byte[InitialBufferSize];
count = 0;
markedLength = -1;
markedIndex = -1;
}
示例9: FileParser
internal FileParser(
IInputStream stream,
files.File file
)
: base(stream)
{
this.file = file;
}
示例10: AfmParser
internal AfmParser(
IInputStream fontData
)
{
FontData = fontData;
Load();
}
示例11: DecryptStream
/// <summary>
/// Decrypt an input stream and output to another stream
/// </summary>
/// <param name="readStream"></param>
/// <param name="outStream"></param>
/// <returns></returns>
public static async Task DecryptStream(IInputStream readStream, IOutputStream outStream, string userDescriptor)
{
// Create a DataProtectionProvider object for the specified descriptor.
DataProtectionProvider Provider = new DataProtectionProvider(userDescriptor);
await Provider.UnprotectStreamAsync(readStream, outStream); // decrypt and output
return;
}
示例12: Open
public void Open(IInputStream input, IOutputStream output)
{
m_DataReader = new DataReader(input);
m_DataReader.ByteOrder = ByteOrder.LittleEndian;
m_Reader.Reader = m_DataReader;
m_DataWriter = new DataWriter(output);
m_DataWriter.ByteOrder = ByteOrder.LittleEndian;
m_Writer.Writer = m_DataWriter;
}
示例13: HashedInputStream
public HashedInputStream(IInputStream stream)
{
if (stream == null)
throw new ArgumentNullException("stream");
_stream = stream;
_sha = HashAlgorithmProvider
.OpenAlgorithm(HashAlgorithmNames.Sha256)
.CreateHash();
}
示例14: writeStream
protected void writeStream(IInputStream input)// throws IOException
{
/*byte[] buffer = new byte[4096];
int read;
while ((read = input.read(buffer)) != -1) {
output.write(buffer, 0, read);
}
input.close();*/
throw new NotImplementedException();
}
示例15: ParseRequestStream
internal async Task<HttpRequest> ParseRequestStream(IInputStream requestStream)
{
var httpStream = new HttpRequestStream(requestStream);
var request = new HttpRequest();
try
{
var stream = await httpStream.ReadAsync(BUFFER_SIZE, InputStreamOptions.Partial);
byte[] streamData = stream.Data;
var requestPipeline = GetPipeline();
using (var pipeLineEnumerator = requestPipeline.GetEnumerator())
{
pipeLineEnumerator.MoveNext();
bool requestComplete = false;
while (!requestComplete)
{
pipeLineEnumerator.Current.HandleRequestPart(streamData, request);
streamData = pipeLineEnumerator.Current.UnparsedData;
if (pipeLineEnumerator.Current.IsFinished)
{
if (!pipeLineEnumerator.Current.IsSucceeded ||
!pipeLineEnumerator.MoveNext())
{
break;
}
}
else
{
var newStreamdata = await httpStream.ReadAsync(BUFFER_SIZE, InputStreamOptions.Partial);
if (!newStreamdata.ReadSuccessful)
{
break;
}
streamData = streamData.ConcatArray(newStreamdata.Data);
}
}
}
request.IsComplete = requestPipeline.All(p => p.IsSucceeded);
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
return request;
}