[111] | 1 |
|
---|
[119] | 2 | #require <Classes/System/misc.ab>
|
---|
| 3 |
|
---|
[112] | 4 | Class Stream
|
---|
[119] | 5 | Public 'Protected
|
---|
[115] | 6 | Sub Stream(): End Sub
|
---|
[114] | 7 | Public
|
---|
[119] | 8 | Virtual Sub ~Stream()
|
---|
| 9 | Close()
|
---|
| 10 | End Sub
|
---|
| 11 | Public
|
---|
| 12 | Abstract Function CanRead() As Boolean
|
---|
| 13 | Abstract Function CanSeek() As Boolean
|
---|
[111] | 14 |
|
---|
[119] | 15 | Virtual Function CanTimeout() As Boolean
|
---|
| 16 | Return True
|
---|
| 17 | End Function
|
---|
| 18 |
|
---|
| 19 | Abstract Function CanWrite() As Boolean
|
---|
| 20 | Abstract Function Length() As Int64
|
---|
| 21 | Abstract Sub Position(value As Int64)
|
---|
| 22 | Abstract Function Position() As Int64
|
---|
| 23 |
|
---|
| 24 | Virtual Sub ReadTimeout(value As Long)
|
---|
| 25 | ' Throw InvalidOperationException
|
---|
| 26 | End Sub
|
---|
| 27 |
|
---|
| 28 | Virtual Function ReadTimeout() As Long
|
---|
| 29 | ' Throw InvalidOperationException
|
---|
| 30 | End Function
|
---|
| 31 |
|
---|
| 32 | Virtual Sub WriteTimeout(value As Long)
|
---|
| 33 | ' Throw InvalidOperationException
|
---|
| 34 | End Sub
|
---|
| 35 |
|
---|
| 36 | Virtual Function WriteTimeout() As Long
|
---|
| 37 | ' Throw InvalidOperationException
|
---|
| 38 | End Function
|
---|
| 39 |
|
---|
[112] | 40 | Public
|
---|
| 41 | Virtual Function BeginRead(ByRef buffer[] As Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As IAsyncResult: End Function
|
---|
| 42 | Virtual Function BeginWrite(ByRef buffer[] As Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As IAsyncResult: End Function
|
---|
| 43 | Virtual Sub Close(): End Sub
|
---|
| 44 | Virtual Function EndRead(ByRef asyncResult As IAsyncResult) As Long: End Function
|
---|
| 45 | Virtual Sub EndWrite(ByRef asyncResult As IAsyncResult): End Sub
|
---|
[119] | 46 | Abstract Sub Flush()
|
---|
| 47 | Abstract Function Read(ByRef buffer[] As Byte, offset As Long, count As Long) As Long
|
---|
[112] | 48 |
|
---|
[119] | 49 | Virtual Function ReadByte() As Long
|
---|
| 50 | Dim b As Byte
|
---|
| 51 | Dim ret = Read(VarPtr(b), 0, 1)
|
---|
| 52 | If ret <> 0 Then
|
---|
| 53 | Return b
|
---|
| 54 | Else
|
---|
| 55 | Return -1
|
---|
| 56 | End If
|
---|
| 57 | End Function
|
---|
| 58 |
|
---|
| 59 | Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Long
|
---|
| 60 | Abstract Sub SetLength(value As Int64): End Sub
|
---|
| 61 | Abstract Sub Write(ByRef buffer[] As Byte, offset As Long, count As Long)
|
---|
| 62 |
|
---|
| 63 | Virtual Sub WriteByte(b As Byte)
|
---|
| 64 | Write(VarPtr(b), 0, 1)
|
---|
| 65 | End Sub
|
---|
[112] | 66 | Protected
|
---|
| 67 | Virtual Function CreateWaitHandle() As WaitHandle: End Function
|
---|
| 68 | End Class
|
---|