Add ioivec::read_whole_file/read_whole_file_str
This commit is contained in:
parent
77be30fa73
commit
a1a25969a0
1 changed files with 12 additions and 0 deletions
|
@ -454,6 +454,18 @@ fn seek_in_buf(offset: int, pos: uint, len: uint, whence: seek_style) ->
|
|||
if bpos < 0 { bpos = 0; } else if (bpos > blen) { bpos = blen; }
|
||||
ret bpos as uint;
|
||||
}
|
||||
|
||||
fn read_whole_file_str(file: &str) -> str {
|
||||
str::unsafe_from_bytes_ivec(read_whole_file(file))
|
||||
}
|
||||
|
||||
fn read_whole_file(file: &str) -> u8[] {
|
||||
// FIXME: There's a lot of copying here
|
||||
file_reader(file).read_whole_stream()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue