Ticket #268 (closed defect: fixed)
Compiler error for read method on System.IO.Stream types
Reported by: | todd.a | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
Calling the .read method on Stream types produces an error suggesting the out modifier be used. When out is used the compiler gives an error saying that out should not be used, which is correct.
extend Stream def readBytes(len as int) as uint8[] bytes = uint8[](len) .read(bytes, 0, len) return bytes class Foo def main ms = MemoryStream(1024) data = Encoding.utf8.getBytes('foobar') ms.write(data, 0, data.length) ms.seek(0, SeekOrigin.Begin) #outputData = ms.readBytes(3) # extension method version outputData = uint8[](3) ms.read(outputData, 0, outputData.length) print Encoding.utf8.getString(outputData, 0, outputData.length)
Change History
Note: See
TracTickets for help on using
tickets.