タグ

ioに関するsudixのブックマーク (3)

  • 低レベルアクセスへの入り口(2):io.Reader前編

    前回はGo言語が提供する io.Writer を紹介しました。 今回と次回は、それと対になる io.Reader を中心に、仲間のインタフェースをいくつか紹介していきます。 「Go言語ではスクリプト言語並にかんたんにファイル読み込みやネットワークアクセスができる」、という説明を見かけたことがある方も多いでしょう。 確かにGo言語には、ファイル読み込みやネットワークアクセスの結果が1行で得られる、次のような関数が用意されています。 ioutil.WriteFile() : これだけを使ってファイルに書き込める ioutil.ReadFile() : これだけを使ってファイルから読み込める http.Get() : これだけを使ってHTTPのGETメソッドでデータを受け取れる http.Post() : これだけを使ってHTTPのPOSTメソッドでデータを送れる 実はこれらのAPIは、今回の記

    低レベルアクセスへの入り口(2):io.Reader前編
  • Go Walkthrough: io

    Go is a programming language built for working with bytes. Whether you have lists of bytes, streams of bytes, or individual bytes, Go makes it easy to process. From these simple primitives we build our abstractions and services. The io package is one of the most fundamental packages within the standard library. It provides a set of interfaces and helpers for working with streams of bytes. This pos

    Go Walkthrough: io
  • Asynchronously Split an io.Reader in Go (golang)

    Or the many ways to skin a cat — er — streamI have fallen in love with the flexibility of io.Reader and io.Writer when dealing with any stream of data in Go. And while I am more or less smitten at this point, the reader interface challenged me with something you might think simple: splitting it in two. I’m not even certain “split” is the right word. I would like to receive an io.Reader and read ov

  • 1