thanks
I assume you're already looking at making a type that's an io.Writer,
It seems logical that, when creating a multipart MIME message, I might want to png.Encode(message, image).On Fri, May 13, 2011 at 3:16 PM, Brad Fitzpatrick <brad...@golang.org> wrote:
On Fri, May 13, 2011 at 1:32 PM, Kyle Lemons <kev...@google.com> wrote:I assume you're already looking at making a type that's an io.Writer,No, that's not a goal. Why would you want to interject raw bytes into a structured message?
Ah, right. I see what you're saying now. Rather than confusing definitions of Flush() and Close(), perhaps:
func (w *Writer) BeginPart(headers textproto.MIMEHeader) io.WriteCloser
We can just return an interface type there, but internally it'd be a &partWriter{...} and would know if it's closed, its boundary, its parent *multipart.Writer, whatever.Calling BeginPart() again would Close() the previous Part's writer, if not already closed.
For the new archive/zip Writer I'm using a Create method on the Writer
type that returns an io.WriteCloser. I don't like the idea of writing
multiple parts to the same Writer - too much state; seems too easy to
accidentally write something at the wrong time. The File abstraction
is a nice one. Open/Create, Read/Write, Close. Just my 2c.
Andrew