本文整理汇总了C#中IOutputStream类的典型用法代码示例。如果您正苦于以下问题:C# IOutputStream类的具体用法?C# IOutputStream怎么用?C# IOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOutputStream类属于命名空间,在下文中一共展示了IOutputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataWriter
public DataWriter (IOutputStream outputStream)
{
if (outputStream == null)
throw new ArgumentNullException ("outputStream");
throw new NotImplementedException();
}
示例2: WriteResponseAsync
private async Task WriteResponseAsync(string[] requestTokens, IOutputStream outstream)
{
// NOTE: If you change the respBody format, change the Content-Type (below) accordingly
//string respBody = weatherData.HTML;
//string respBody = weatherData.XML;
string respBody = weatherData.JSON;
string htmlCode = "200 OK";
using (Stream resp = outstream.AsStreamForWrite())
{
byte[] bodyArray = Encoding.UTF8.GetBytes(respBody);
MemoryStream stream = new MemoryStream(bodyArray);
// NOTE: If you change the respBody format (above), change the Content-Type accordingly
string header = string.Format("HTTP/1.1 {0}\r\n" +
//"Content-Type: text/html\r\n" + // HTML only
//"Content-Type: text/xml\r\n" + // XML only
"Content-Type: text/json\r\n" + // JSON only
"Content-Length: {1}\r\n" +
"Connection: close\r\n\r\n",
htmlCode, stream.Length);
byte[] headerArray = Encoding.UTF8.GetBytes(header);
await resp.WriteAsync(headerArray, 0, headerArray.Length);
await stream.CopyToAsync(resp);
await resp.FlushAsync();
}
}
示例3: WriteTo
public override void WriteTo(
IOutputStream stream,
Document context
)
{
stream.Write(value);
}
示例4: CompressedWriter
internal CompressedWriter(
files.File file,
IOutputStream stream
)
: base(file, stream)
{
}
示例5: Initialize
public bool Initialize(IOutputStream _stream)
{
stream = _stream;
Print("Controller.Initialize is success.");
return true;
}
示例6: RegisterOutputStream
/// <summary>
/// Register output stream.
/// </summary>
/// <param name="output_stream"></param>
public static void RegisterOutputStream(
IOutputStream output_stream)
{
OutputStreamHost.InitializeIfNeeded();
_output_streams.Add(output_stream);
}
示例7: Copy
/// <exception cref="System.IO.IOException"></exception>
protected virtual void Copy(Socket4Adapter sock, IOutputStream rawout, int length
, bool update)
{
BufferedOutputStream @out = new BufferedOutputStream(rawout);
byte[] buffer = new byte[BlobImpl.CopybufferLength];
int totalread = 0;
while (totalread < length)
{
int stilltoread = length - totalread;
int readsize = (stilltoread < buffer.Length ? stilltoread : buffer.Length);
int curread = sock.Read(buffer, 0, readsize);
if (curread < 0)
{
throw new IOException();
}
@out.Write(buffer, 0, curread);
totalread += curread;
if (update)
{
_currentByte += curread;
}
}
@out.Flush();
@out.Close();
}
示例8: 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);
}
示例9: Writer
protected Writer(
File file,
IOutputStream stream
)
{
this.file = file;
this.stream = stream;
}
示例10: WriteTo
public override void WriteTo(
IOutputStream stream,
Document context
)
{
stream.Write(BeginChunk);
base.WriteTo(stream, context);
stream.Write(EndChunk);
}
示例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: DownloadAsync
public IAsyncAction DownloadAsync(IRecord record, IOutputStream destination)
{
if (record == null)
{
throw new ArgumentNullException("record");
}
return record.DownloadBlob(this, destination);
}
示例13: 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;
}
示例14: HashedOutputStream
public HashedOutputStream(IOutputStream stream)
{
if (stream == null)
throw new ArgumentNullException("stream");
_stream = stream;
_sha = HashAlgorithmProvider
.OpenAlgorithm(HashAlgorithmNames.Sha256)
.CreateHash();
}
示例15: RemotePeer
public RemotePeer(ICommandSerializer serializer, ICommandsTransportResource transport, IOutputStream stream, HostName host, string port)
{
_serializer = serializer;
_transport = transport;
_dataWriter = new DataWriter(stream);
HostName = host.RawName;
Port = port;
HandleActivity();
_transport.Received += _transport_Received;
}