diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-04-09 09:44:58 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-04-09 09:44:58 -0700 |
| commit | abde40377c74a0580e4821e21ef2402900b81d60 (patch) | |
| tree | 4f26b411d7748240a13b19edadcbaac78a9d82f5 /go/util/file_util.go | |
| parent | 67be8a5af8cd731de4cbe81feb3328b99303f9ef (diff) | |
| download | seaweedfs-abde40377c74a0580e4821e21ef2402900b81d60.tar.xz seaweedfs-abde40377c74a0580e4821e21ef2402900b81d60.zip | |
a correct implementation of filer
Diffstat (limited to 'go/util/file_util.go')
| -rw-r--r-- | go/util/file_util.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/go/util/file_util.go b/go/util/file_util.go index 8444296d3..9f3354011 100644 --- a/go/util/file_util.go +++ b/go/util/file_util.go @@ -1,6 +1,7 @@ package util import ( + "bufio" "code.google.com/p/weed-fs/go/glog" "errors" "os" @@ -21,3 +22,16 @@ func TestFolderWritable(folder string) (err error) { } return errors.New("Not writable!") } + +func Readln(r *bufio.Reader) ([]byte, error) { + var ( + isPrefix bool = true + err error = nil + line, ln []byte + ) + for isPrefix && err == nil { + line, isPrefix, err = r.ReadLine() + ln = append(ln, line...) + } + return ln, err +} |
