Skip to content

Commit 7283c3a

Browse files
committed
Polyfil for bytesavailable
1 parent fe16d8b commit 7283c3a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Indexes.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ import BGZFStreams
1414
import BioGenerics
1515
import GenomicFeatures: Interval
1616

17+
function Base.bytesavailable(stream::BGZFStreams.BGZFStream{IOStream})
18+
19+
block_index = BGZFStreams.ensure_buffered_data(stream)
20+
if block_index == 0
21+
return 0
22+
end
23+
block = stream.blocks[block_index]
24+
25+
return length(block.position:block.size)
26+
27+
end
28+
1729
include("chunk.jl")
1830
include("bgzfindex.jl")
1931
include("tabix.jl")

0 commit comments

Comments
 (0)