Skip to content

Commit

Permalink
BlockIO: fix find_end_pos/find_start_pos in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
iblislin committed Feb 2, 2018
1 parent 5c79554 commit 68797a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/block-io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ struct BlockIO <: IO

function find_end_pos(bio::BlockIO, end_byte::Char)
seekend(bio)
end_byte = UInt8(end_byte)
try
while(!eof(bio.s) && (end_byte != read(bio, UInt8))) continue end
end
position(bio.s)
end

function find_start_pos(bio::BlockIO, end_byte::Char)
(bio.r.start == 1) && (return bio.r.start)
seekstart(bio)
end_byte = UInt8(end_byte)
!eof(bio.s) && while(end_byte != read(bio, UInt8)) continue end
position(bio.s)+1
end
Expand Down

0 comments on commit 68797a2

Please sign in to comment.