Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
NativeStreamWrapper.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.IO;
5 using System.Threading;
6 using System.Threading.Tasks;
7 
8 namespace SiliconStudio.Core.IO
9 {
11  {
12  private Stream stream;
13 
14  public NativeStreamWrapper(Stream stream)
15  {
16  this.stream = stream;
17  }
18 
19  /// <inheritdoc/>
20  public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
21  {
22  return stream.CopyToAsync(destination, bufferSize, cancellationToken);
23  }
24 
25  /// <inheritdoc/>
26  public override void Flush()
27  {
28  stream.Flush();
29  }
30 
31  /// <inheritdoc/>
32  public override Task FlushAsync(CancellationToken cancellationToken)
33  {
34  return stream.FlushAsync(cancellationToken);
35  }
36 
37  /// <inheritdoc/>
38  public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
39  {
40  return stream.ReadAsync(buffer, offset, count, cancellationToken);
41  }
42 
43  /// <inheritdoc/>
44  public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
45  {
46  return stream.WriteAsync(buffer, offset, count, cancellationToken);
47  }
48 
49  /// <inheritdoc/>
50  public override long Seek(long offset, SeekOrigin origin)
51  {
52  return stream.Seek(offset, origin);
53  }
54 
55  /// <inheritdoc/>
56  public override void SetLength(long value)
57  {
58  stream.SetLength(value);
59  }
60 
61  /// <inheritdoc/>
62  public override int Read(byte[] buffer, int offset, int count)
63  {
64  return stream.Read(buffer, offset, count);
65  }
66 
67  /// <inheritdoc/>
68  public override int ReadByte()
69  {
70  return stream.ReadByte();
71  }
72 
73  /// <inheritdoc/>
74  public override void Write(byte[] buffer, int offset, int count)
75  {
76  stream.Write(buffer, offset, count);
77  }
78 
79  /// <inheritdoc/>
80  public override void WriteByte(byte value)
81  {
82  stream.WriteByte(value);
83  }
84 
85  /// <inheritdoc/>
86  public override bool CanRead
87  {
88  get { return stream.CanRead; }
89  }
90 
91  /// <inheritdoc/>
92  public override bool CanSeek
93  {
94  get { return stream.CanSeek; }
95  }
96 
97  /// <inheritdoc/>
98  public override bool CanTimeout
99  {
100  get { return stream.CanTimeout; }
101  }
102 
103  /// <inheritdoc/>
104  public override bool CanWrite
105  {
106  get { return stream.CanWrite; }
107  }
108 
109  /// <inheritdoc/>
110  public override long Length
111  {
112  get { return stream.Length; }
113  }
114 
115  /// <inheritdoc/>
116  public override long Position
117  {
118  get { return stream.Position; }
119  set { stream.Position = value; }
120  }
121 
122  /// <inheritdoc/>
123  public override int ReadTimeout
124  {
125  get { return stream.ReadTimeout; }
126  set { stream.ReadTimeout = value; }
127  }
128 
129  /// <inheritdoc/>
130  public override int WriteTimeout
131  {
132  get { return stream.WriteTimeout; }
133  set { stream.WriteTimeout = value; }
134  }
135  }
136 }
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override int Read(byte[] buffer, int offset, int count)
override Task FlushAsync(CancellationToken cancellationToken)
override long Seek(long offset, SeekOrigin origin)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
_In_ size_t count
Definition: DirectXTexP.h:174
override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
A Stream with additional methods for native read and write operations using IntPtr.
Definition: NativeStream.cs:11