-
-
Save zoffixznet/588fac94d26f6aa77d9941f4e64c1d1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit class IO::String2 is IO::Handle; | |
has Buf $!content; | |
submethod TWEAK(:$buffer) { | |
$!content := Buf.new: $buffer.encode; | |
self.encoding: 'utf8'; # set up encoder/decoder | |
} | |
method open(|) { self } | |
method close(|) { self } | |
method opened { ! self.EOF } | |
method lock(| --> True) { } | |
method unlock( --> True) { } | |
method WRITE(\b --> True) { $!content.append: b } | |
method READ(\bytes) { $!content.splice: 0, bytes } | |
method EOF { not $!content } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment