# ticket:268 extend Stream def readBytes(len as int) as uint8[] bytes = uint8[](len) .read(bytes, 0, len) # was generating a false error about needing `out` for first argument return bytes class Foo def main ms = MemoryStream(1024) data = Encoding.utf8.getBytes('foobar') ms.write(data, 0, data.length) outputData = uint8[](3) ms.seek(0, SeekOrigin.Begin) ms.read(outputData, 0, outputData.length) s = Encoding.utf8.getString(outputData, 0, outputData.length) assert s == 'foo' ms.seek(0, SeekOrigin.Begin) outputData = ms.readBytes(3) s = Encoding.utf8.getString(outputData, 0, outputData.length) assert s == 'foo'