Changeset 682 for trunk/ab5.0/ablib/src/Classes/System/IO
- Timestamp:
- Feb 16, 2009, 4:26:24 PM (15 years ago)
- Location:
- trunk/ab5.0/ablib/src/Classes/System/IO
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab
r617 r682 339 339 End Function*/ 340 340 341 Function ToPointer() As VoidPtr 342 ToPointer = pointer 343 End Function 344 341 345 /*! 342 346 @brief ストリームの内容全体をまるごと別のストリームに書き込みます。 -
trunk/ab5.0/ablib/src/Classes/System/IO/Stream.ab
r609 r682 155 155 End Class 156 156 157 /*! 158 @brief 書き込みバイト数を記憶するヌルストリーム 159 Encoding関連で使用 160 @date 2009/02/16 161 @auther Egtra 162 */ 163 Class WriteCountingNullStream 164 Inherits NullStream 165 Public 166 Sub WriteCountingNullStream() 167 writeCount = 0 168 End Sub 169 170 Override Sub Write(buffer As *Byte, offset As Long, count As Long) 171 If count < 0 Then 172 Throw New ArgumentOutOfRangeException("count") 173 End If 174 writeCount += count 175 End Sub 176 177 Override Sub WriteByte(b As Byte) 178 writeCount++ 179 End Sub 180 181 /*! 182 @brief 書き込まれたバイト数を返す。 183 */ 184 Function WriteCount() As Long 185 WriteCount = writeCount 186 End Function 187 188 Private 189 writeCount As Long 190 End Class 191 157 192 End Namespace 158 193 -
trunk/ab5.0/ablib/src/Classes/System/IO/StreamWriter.ab
r676 r682 20 20 */ 21 21 Sub StreamWriter(path As String) 22 init(New FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None) )22 init(New FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None), Nothing) 23 23 End Sub 24 24 … … 28 28 */ 29 29 Sub StreamWriter(stream As Stream) 30 init(stream) 30 init(stream, Nothing) 31 End Sub 32 33 /* 34 @date 2009/02/16 35 @auther Egtra 36 */ 37 Sub StreamWriter(stream As Stream, encoding As Text.Encoding) 38 init(stream, encoding) 31 39 End Sub 32 40 … … 83 91 84 92 Private 85 Sub init(stream As Stream )93 Sub init(stream As Stream, e As Text.Encoding) 86 94 s = stream 87 95 buf = New Text.StringBuilder(4096) 88 '暫定。正式版ではUTF-8を標準とする。 89 encoder = New Text.Detail.WindowsCodePageEncoder(CP_ACP) 96 If ActiveBasic.IsNothing(e) Then 97 '暫定。正式版ではUTF-8を標準とする。 98 encoder = New Text.Detail.WindowsCodePageEncoder(CP_ACP) 99 Else 100 encoder = e.GetEncoder() 101 End If 90 102 End Sub 91 103
Note:
See TracChangeset
for help on using the changeset viewer.