[Go] Take a look at io.Writer

I researched Go's io.Writer interface.

What is io.Writer

io.Writer is the following interface.

type Writer interface {
    Write(p []byte) (n int, err error)
}

It has a write method.

I see various write methods

--File input / output --Write to connection --Write to buffer

There are various write methods such as.

This is because the above write method is implemented in file, TCPConn, and Buffer. You can write to each file.

The idea of ​​a file

Earlier, I used the phrase file, but there is a file descriptor. This is the OS abstraction mechanism provided at the kernel layer. Specifically, it's like a numeric identifier

--0: Standard input --1: Standard output -2: Standard error output

The corresponding one is decided for each numerical value like.

There are various corresponding ones such as sockets as well as files. However, all of them can be accessed and written in the same way as files, so It is abstracted with the idea of ​​a `file. ``

This io.Writer imitates a file descriptor and is implemented in Go language.

Reference article

Thank you very much. -Entrance to low-level access (1): io.Writer

Recommended Posts

[Go] Take a look at io.Writer
Take a look at Django's template.
Take a look at profiling and dumping with Dataflow
Take a closer look at the Kaggle / Titanic tutorial
Take a look at the Python built-in exception tree structure
Let's take a look at the feature map of YOLO v3
Take a look at the built-in exception tree structure in Python 3.8.2
Let's take a look at the Scapy code. How are you processing the structure?
[Python] Take a screenshot
Take a peek at the processing of LightGBM Tuner
Look at the game records of Go professional Go players
Challenge image classification by TensorFlow2 + Keras 2 ~ Let's take a closer look at the input data ~
Let's take a quick look at CornerNet, an object detector that does not use anchors.
A quick look at your profile within the django app
Take a screenshot in Python
I took a closer look at why Python self is needed
Let's take a look at the forest fire on the west coast of the United States with satellite images.
Let's take a look at the Scapy code. Overload of special methods __div__, __getitem__ and so on.