[271] | 1 | Namespace System
|
---|
| 2 | Namespace IO
|
---|
[111] | 3 |
|
---|
[271] | 4 |
|
---|
[112] | 5 | Class Stream
|
---|
[605] | 6 | Implements IDisposable
|
---|
[347] | 7 |
|
---|
[605] | 8 | Protected
|
---|
[468] | 9 | Sub Stream()
|
---|
| 10 | End Sub
|
---|
[114] | 11 | Public
|
---|
[605] | 12 | Sub ~Stream()
|
---|
[388] | 13 | This.Dispose(False)
|
---|
[119] | 14 | End Sub
|
---|
| 15 | Public
|
---|
| 16 | Abstract Function CanRead() As Boolean
|
---|
| 17 | Abstract Function CanSeek() As Boolean
|
---|
[111] | 18 |
|
---|
[119] | 19 | Virtual Function CanTimeout() As Boolean
|
---|
[605] | 20 | Return False
|
---|
[119] | 21 | End Function
|
---|
| 22 |
|
---|
| 23 | Abstract Function CanWrite() As Boolean
|
---|
[605] | 24 | Abstract Function Length() As QWord
|
---|
| 25 | Abstract Sub Position(value As QWord)
|
---|
| 26 | Abstract Function Position() As QWord
|
---|
[119] | 27 |
|
---|
| 28 | Virtual Sub ReadTimeout(value As Long)
|
---|
[605] | 29 | Throw New InvalidOperationException("Stream does not support Timeout.")
|
---|
[119] | 30 | End Sub
|
---|
| 31 |
|
---|
| 32 | Virtual Function ReadTimeout() As Long
|
---|
[605] | 33 | Throw New InvalidOperationException("Stream does not support Timeout.")
|
---|
[119] | 34 | End Function
|
---|
| 35 |
|
---|
| 36 | Virtual Sub WriteTimeout(value As Long)
|
---|
[605] | 37 | Throw New InvalidOperationException("Stream does not support Timeout.")
|
---|
[119] | 38 | End Sub
|
---|
| 39 |
|
---|
| 40 | Virtual Function WriteTimeout() As Long
|
---|
[605] | 41 | Throw New InvalidOperationException("Stream does not support Timeout.")
|
---|
[119] | 42 | End Function
|
---|
| 43 |
|
---|
[112] | 44 | Public
|
---|
[347] | 45 | Virtual Function BeginRead(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
|
---|
[605] | 46 | Dim r = Read(buffer,offset,count)
|
---|
| 47 | Return New Detail.SyncStreamResultImpl(r, state)
|
---|
[347] | 48 | End Function
|
---|
| 49 | Virtual Function BeginWrite(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
|
---|
| 50 | Write(buffer,offset,count)
|
---|
[605] | 51 | Return New Detail.SyncStreamResultImpl(0, state)
|
---|
[347] | 52 | End Function
|
---|
[432] | 53 | Sub Close()
|
---|
[388] | 54 | Dispose(True)
|
---|
[347] | 55 | End Sub
|
---|
[432] | 56 | Sub Dispose()
|
---|
[388] | 57 | Dispose(True)
|
---|
| 58 | End Sub
|
---|
[568] | 59 | Virtual Function EndRead(asyncResult As System.IAsyncResult) As Long
|
---|
[605] | 60 | Dim ar = asyncResult As Detail.IAsyncStreamResult
|
---|
| 61 | EndRead = ar.WaitAndGetResult
|
---|
[468] | 62 | End Function
|
---|
[568] | 63 | Virtual Sub EndWrite(asyncResult As System.IAsyncResult)
|
---|
[468] | 64 | End Sub
|
---|
[119] | 65 | Abstract Sub Flush()
|
---|
[337] | 66 | Abstract Function Read(buffer As *Byte, offset As Long, count As Long) As Long
|
---|
[112] | 67 |
|
---|
[119] | 68 | Virtual Function ReadByte() As Long
|
---|
| 69 | Dim b As Byte
|
---|
[337] | 70 | Dim ret = Read(VarPtr(b), 0, 1)
|
---|
[119] | 71 | If ret <> 0 Then
|
---|
| 72 | Return b
|
---|
| 73 | Else
|
---|
| 74 | Return -1
|
---|
| 75 | End If
|
---|
| 76 | End Function
|
---|
| 77 |
|
---|
[391] | 78 | Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Int64
|
---|
[605] | 79 | Abstract Sub SetLength(value As QWord)
|
---|
[337] | 80 | Abstract Sub Write(buffer As *Byte, offset As Long, count As Long)
|
---|
[119] | 81 | Virtual Sub WriteByte(b As Byte)
|
---|
[337] | 82 | Write(VarPtr(b), 0, 1)
|
---|
[119] | 83 | End Sub
|
---|
[112] | 84 | Protected
|
---|
[432] | 85 | Virtual Sub Dispose(disposing As Boolean)
|
---|
| 86 | End Sub
|
---|
[112] | 87 | End Class
|
---|
[271] | 88 |
|
---|
| 89 |
|
---|
| 90 | End Namespace
|
---|
| 91 | End Namespace
|
---|