Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
5b1fb9d5
Commit
5b1fb9d5
authored
May 26, 2011
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io: add ByteScanner, RuneScanner interfaces
R=r, rsc CC=golang-dev
https://golang.org/cl/4530069
parent
9cd3372f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
src/pkg/io/io.go
src/pkg/io/io.go
+24
-0
No files found.
src/pkg/io/io.go
View file @
5b1fb9d5
...
...
@@ -162,6 +162,18 @@ type ByteReader interface {
ReadByte
()
(
c
byte
,
err
os
.
Error
)
}
// ByteScanner is the interface that adds the UnreadByte method to the
// basic ReadByte method.
//
// UnreadByte causes the next call to ReadByte to return the same byte
// as the previous call to ReadByte.
// It may be an error to call UnreadByte twice without an intervening
// call to ReadByte.
type
ByteScanner
interface
{
ByteReader
UnreadByte
()
os
.
Error
}
// RuneReader is the interface that wraps the ReadRune method.
//
// ReadRune reads a single UTF-8 encoded Unicode character
...
...
@@ -171,6 +183,18 @@ type RuneReader interface {
ReadRune
()
(
rune
int
,
size
int
,
err
os
.
Error
)
}
// RuneScanner is the interface that adds the UnreadRune method to the
// basic ReadRune method.
//
// UnreadRune causes the next call to ReadRune to return the same rune
// as the previous call to ReadRune.
// It may be an error to call UnreadRune twice without an intervening
// call to ReadRune.
type
RuneScanner
interface
{
RuneReader
UnreadRune
()
os
.
Error
}
// WriteString writes the contents of the string s to w, which accepts an array of bytes.
func
WriteString
(
w
Writer
,
s
string
)
(
n
int
,
err
os
.
Error
)
{
return
w
.
Write
([]
byte
(
s
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment