本文整理汇总了C#中IOutputStream类的典型用法代码示例。如果您正苦于以下问题:C# IOutputStream类的具体用法?C# IOutputStream怎么用?C# IOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOutputStream类属于命名空间,在下文中一共展示了IOutputStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DataWriter
public DataWriter (IOutputStream outputStream)
{
if (outputStream == null)
throw new ArgumentNullException ("outputStream");
throw new NotImplementedException();
}
开发者ID:ermau,项目名称:WinRT.NET,代码行数:7,代码来源:DataWriter.cs
示例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();
}
}
开发者ID:JimGaleForce,项目名称:iot-build-lab,代码行数:29,代码来源:HttpServer.cs
示例3: WriteTo
public override void WriteTo(
IOutputStream stream,
Document context
)
{
stream.Write(value);
}
开发者ID:n9,项目名称:pdfclown,代码行数:7,代码来源:InlineImageBody.cs
示例4: CompressedWriter
internal CompressedWriter(
files.File file,
IOutputStream stream
)
: base(file, stream)
{
}
开发者ID:n9,项目名称:pdfclown,代码行数:7,代码来源:CompressedWriter.cs
示例5: Initialize
public bool Initialize(IOutputStream _stream)
{
stream = _stream;
Print("Controller.Initialize is success.");
return true;
}
开发者ID:gordonlee,项目名称:testlab,代码行数:7,代码来源:CommandController.cs
示例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);
}
开发者ID:jorik041,项目名称:osmsharp,代码行数:11,代码来源:OutputStreamHost.cs
示例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();
}
开发者ID:erdincay,项目名称:db4o,代码行数:26,代码来源:MsgBlob.cs
示例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);
}
开发者ID:CarltonSemple,项目名称:WindowsApps,代码行数:15,代码来源:DataEncryption.cs
示例9: Writer
protected Writer(
File file,
IOutputStream stream
)
{
this.file = file;
this.stream = stream;
}
开发者ID:josuecorrea,项目名称:DanfeSharp,代码行数:8,代码来源:Writer.cs
示例10: WriteTo
public override void WriteTo(
IOutputStream stream,
Document context
)
{
stream.Write(BeginChunk);
base.WriteTo(stream, context);
stream.Write(EndChunk);
}
开发者ID:josuecorrea,项目名称:DanfeSharp,代码行数:9,代码来源:Text.cs
示例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;
}
开发者ID:CarltonSemple,项目名称:WindowsApps,代码行数:15,代码来源:DataEncryption.cs
示例12: DownloadAsync
public IAsyncAction DownloadAsync(IRecord record, IOutputStream destination)
{
if (record == null)
{
throw new ArgumentNullException("record");
}
return record.DownloadBlob(this, destination);
}
开发者ID:shashidharpalli,项目名称:Enabling-Programmable-Self-with-HealthVault,代码行数:9,代码来源:Blob.cs
示例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;
}
开发者ID:spinglass,项目名称:PerformantApp,代码行数:10,代码来源:Sender.cs
示例14: HashedOutputStream
public HashedOutputStream(IOutputStream stream)
{
if (stream == null)
throw new ArgumentNullException("stream");
_stream = stream;
_sha = HashAlgorithmProvider
.OpenAlgorithm(HashAlgorithmNames.Sha256)
.CreateHash();
}
开发者ID:Confuset,项目名称:7Pass-Remake,代码行数:10,代码来源:HashedOutputStream.cs
示例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;
}
开发者ID:Bootz,项目名称:VoIP_Project_Archives_Testing,代码行数:10,代码来源:RemotePeer.cs
示例16: SendFile
public SendFile(IOutputStream outputStream,string filename)
{
_writer = new DataWriter(outputStream);
IStorageFolder local = ApplicationData.Current.LocalFolder;
Task<Stream> taskStream = local.OpenStreamForReadAsync(filename);
taskStream.Wait();
Stream s = taskStream.Result;
_file = new byte[s.Length];
s.Read(_file, 0, _file.Length);
}
开发者ID:lillo42,项目名称:IoT,代码行数:12,代码来源:SendFile.cs
示例17: Impl
/// <summary>
/// This method supports the framework directly and should not be used from your code
/// </summary>
/// <param name="handler">The handler.</param>
/// <param name="context">The context.</param>
/// <returns></returns>
public static void Impl(IOutputStream handler, IContext context)
{
context.Response.ContentType = handler.ContentType;
if (!string.IsNullOrWhiteSpace(handler.ContentDisposition))
{
context.Response.SetHeader("Content-Disposition", handler.ContentDisposition);
}
if (context.Request.HttpMethod.Equals("HEAD")) return;
using (var stream = handler.Output)
{
stream.Position = 0;
stream.CopyTo(context.Response.OutputStream);
}
}
开发者ID:ChristopherMeek,项目名称:Simple.Web,代码行数:21,代码来源:WriteStreamResponse.cs
示例18: WriteResponseAsync
private async Task WriteResponseAsync(string request, IOutputStream os)
{
// Show the html
using (Stream resp = os.AsStreamForWrite())
{
using (var file = File.OpenRead(htmlPath))
{
string header = $"HTTP/1.1 200 OK\r\nContent-Length: {file.Length}\r\n" +
"Content-Type:text/html\r\nConnection: close\r\n\r\n";
byte[] headerArray = Encoding.UTF8.GetBytes(header);
await resp.WriteAsync(headerArray, 0, headerArray.Length);
await file.CopyToAsync(resp);
}
}
}
开发者ID:jmservera,项目名称:ConnectedChristmasTree,代码行数:15,代码来源:CustomWebServer.cs
示例19: CopyStreamAsync
public static async Task CopyStreamAsync(this IInputStream src, IOutputStream outStream, uint bufferSize = 16384)
{
using (var rd = new DataReader(src))
{
using (var wr = new DataWriter(outStream))
{
do
{
var r = await rd.LoadAsync(bufferSize);
if (r <= 0) break;
var buf = new byte[r];
rd.ReadBytes(buf);
wr.WriteBytes(buf);
await wr.FlushAsync();
} while (true);
}
}
}
开发者ID:Opiumtm,项目名称:DvachBrowser3,代码行数:18,代码来源:StreamHelpers.cs
示例20: Impl
/// <summary>
/// This method supports the framework directly and should not be used from your code
/// </summary>
/// <param name="handler">The handler.</param>
/// <param name="context">The context.</param>
/// <returns></returns>
public static void Impl(IOutputStream handler, IContext context)
{
context.Response.SetContentType(handler.ContentType);
if (!string.IsNullOrWhiteSpace(handler.ContentDisposition))
{
context.Response.SetHeader("Content-Disposition", handler.ContentDisposition);
}
if (context.Request.HttpMethod.Equals("HEAD")) return;
context.Response.WriteFunction = (stream, token) =>
{
using (var outputStream = handler.Output)
{
outputStream.Position = 0;
outputStream.CopyTo(stream);
}
return TaskHelper.Completed();
};
}
开发者ID:vandenbergjp,项目名称:Simple.Web,代码行数:25,代码来源:WriteStreamResponse.cs
注:本文中的IOutputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论