Changeset 468 for trunk/Include/Classes/System/IO/StreamWriter.ab
- Timestamp:
- Mar 9, 2008, 12:00:01 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/IO/StreamWriter.ab
r271 r468 4 4 5 5 Class StreamWriter 6 ' TODO: 実装 6 Inherits TextWriter 7 Public 8 /* 9 @date 2008/02/25 10 @auther Egtra 11 */ 12 Sub StreamWriter(path As String) 13 init(New FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) 14 End Sub 15 16 /* 17 @date 2008/02/25 18 @auther Egtra 19 */ 20 Sub StreamWriter(stream As Stream) 21 init(stream) 22 End Sub 23 24 Override Sub Write(str As String) 25 buf.Append(str) 26 Dim len = buf.Length 27 If len >= 2048 Then 28 s.Write(StrPtr(buf) As *Byte, 0, len) 29 buf.Length = 0 30 End If 31 End Sub 32 33 Override Sub Write(x As Boolean) 34 buf.Append(x) 35 End Sub 36 37 Override Sub Write(x As Char) 38 buf.Append(x) 39 End Sub 40 41 Override Sub Write(x As Byte) 42 buf.Append(x) 43 End Sub 44 #ifdef UNICODE 45 Override Sub Write(x As SByte) 46 buf.Append(x) 47 End Sub 48 #else 49 Override Sub Write(x As Word) 50 buf.Append(x) 51 End Sub 52 #endif 53 Override Sub Write(x As Integer) 54 buf.Append(x) 55 End Sub 56 57 Override Sub Write(x As DWord) 58 buf.Append(x) 59 End Sub 60 61 Override Sub Write(x As Long) 62 buf.Append(x) 63 End Sub 64 65 Override Sub Write(x As QWord) 66 buf.Append(x) 67 End Sub 68 69 Override Sub Write(x As Int64) 70 buf.Append(x) 71 End Sub 72 73 Override Sub Write(x As Single) 74 buf.Append(x) 75 End Sub 76 77 Override Sub Write(x As Double) 78 buf.Append(x) 79 End Sub 80 81 Override Sub Write(x As Object) 82 Write(x.ToString) 83 End Sub 84 85 Protected 86 Override Sub Dispose(disposing As Boolean) 87 If disposing Then 88 s.Dispose() 89 End If 90 End Sub 91 92 Private 93 Sub init(stream As Stream) 94 s = stream 95 buf = New System.Text.StringBuilder(4096) 96 End Sub 97 98 buf As Text.StringBuilder 99 s As System.IO.Stream 7 100 End Class 8 101
Note:
See TracChangeset
for help on using the changeset viewer.