Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"syscall"
)

// This implements io.ReadCloser interface
type Reader struct {
source io.Reader
converter *Converter
Expand Down Expand Up @@ -61,6 +62,11 @@ func (this *Reader) fillBuffer() {
}
}

// Must be called to free memory
func (this *Reader) Close() error {
return this.converter.Close()
}

// implement the io.Reader interface
func (this *Reader) Read(p []byte) (n int, err error) {
// checks for when we have no data
Expand Down
6 changes: 6 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package iconv

import "io"

// This implements io.WriteCloser interface
type Writer struct {
destination io.Writer
converter *Converter
Expand Down Expand Up @@ -58,6 +59,11 @@ func (this *Writer) emptyBuffer() {
}
}

// Must be called to free memory
func (this *Writer) Close() error {
return this.converter.Close()
}

// implement the io.Writer interface
func (this *Writer) Write(p []byte) (n int, err error) {
// write data into our internal buffer
Expand Down