On Tue, Jun 28, 2016 at 12:36 PM, mhhcbon <cpasmaboiteas...@gmail.com>
wrote:

> > > This does not work in cases where someone want to use a Transformer in
> a streaming context (e.g. to create a Reader or Writer or to include the
> Transform in a Chain).
>
> This really is what i was looking to implement, somehow,
>
> src -> transform -> transform -> sink
>
>
> > I've used bufio.Scanner to implement a custom transforming stream
> reader.
>
> Indeed, that is a step forward for a much better implementation than
> previous solution. thanks!
>
> Is there any formalized stream transform like apis in go that i missed ?
> Something like another language implements :x
>
Are you referring to something like streams in NodeJS?

The equivalent of this in Go would be io.Reader and io.Writer and friends.
Transformers in text are lower-level and allow for easier to implement, but
above all, more efficient implementations of transforms. For text the
latter is often quite important.

Once you created a transform using Chain, you can convert it to a Reader or
Writer, for instance, using transform.Reader or transform.Writer.

BTW, regarding your original problem, it is often more desirable to replace
non-ASCII by encoding.ASCIISub (U+001a). This is the default behavior of
the charmap.Windows1252 encoder.  If you want to use "?" instead, it may be
better to replace U+001a with '?' instead of just replacing non-ASCII.






>
>
> Le mardi 28 juin 2016 11:54:25 UTC+2, Tamás Gulácsi a écrit :
>>
>> I've used bufio.Scanner to implement a custom transforming stream reader.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to