-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CopyFrom / CopyTo to fsys.Files (#151)
Signed-off-by: Kimmo Lehto <[email protected]>
- Loading branch information
Showing
7 changed files
with
167 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package rigfs | ||
|
||
// ByteCounter is a simple io.Writer that counts the number of bytes written to it, to be used in | ||
// conjunction with io.MultiWriter / io.TeeReader | ||
type ByteCounter struct { | ||
count int64 | ||
} | ||
|
||
// Write implements io.Writer | ||
func (bc *ByteCounter) Write(p []byte) (int, error) { | ||
bc.count += int64(len(p)) | ||
return len(p), nil | ||
} | ||
|
||
// Count returns the number of bytes written to the ByteCounter | ||
func (bc *ByteCounter) Count() int64 { | ||
return bc.count | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters