Background:
I'm a newbie with 0.5 days of Go experience. Google search told me that
bufio.Scanner was nice for looping over text lines, so I had a look at this
page http://golang.org/pkg/bufio/#NewScanner
func NewScanner(r io <http://golang.org/pkg/io/>.Reader <http://golang.org/pkg/io/#Reader>) *Scanner <http://golang.org/pkg/bufio/#Scanner>
The signature tells me I should pass an instance of the io.Reader
interface. However, since Go adapts structural (rather than nominal)
typing for its interfaces, I was at first perplexed about finding concrete
types satisfying the interface. (Now I know os.File is one of them.)
On the other hand, Javadoc has "All known implementing classes" section for
a given interface, which I often find useful. See, eg.
http://docs.oracle.com/javase/7/docs/api/java/nio/channels/Channel.html
All Known Implementing Classes: AbstractInterruptibleChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/spi/AbstractInterruptibleChannel.html>,
AbstractSelectableChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/spi/AbstractSelectableChannel.html>,
AsynchronousFileChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousFileChannel.html>,
AsynchronousServerSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousServerSocketChannel.html>,
AsynchronousSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousSocketChannel.html>,
DatagramChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/DatagramChannel.html>,
FileChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html>,
Pipe.SinkChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/Pipe.SinkChannel.html>,
Pipe.SourceChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/Pipe.SourceChannel.html>,
SelectableChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SelectableChannel.html>,
ServerSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/ServerSocketChannel.html>,
SocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html>
AsynchronousFileChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousFileChannel.html>,
AsynchronousServerSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousServerSocketChannel.html>,
AsynchronousSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousSocketChannel.html>,
DatagramChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/DatagramChannel.html>,
FileChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html>,
Pipe.SinkChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/Pipe.SinkChannel.html>,
Pipe.SourceChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/Pipe.SourceChannel.html>,
SelectableChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SelectableChannel.html>,
ServerSocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/ServerSocketChannel.html>,
SocketChannel<http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html>
Question:
Are there anything like this in the Go world, at least for the standard
libraries?
Best regards,
Kai
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.