Add InputStream.endPos
This commit is contained in:
parent
3d324a8558
commit
c8a7409c96
1 changed files with 6 additions and 0 deletions
|
|
@ -36,6 +36,8 @@ type
|
|||
ByteStreamVar* = ref ByteStream
|
||||
AsciiStreamVar* = ref AsciiStream
|
||||
|
||||
InputStreamVar* = ref ByteStream
|
||||
|
||||
proc openFile*(filename: string): ByteStreamVar =
|
||||
new result
|
||||
var memFile = memfiles.open(filename)
|
||||
|
|
@ -69,6 +71,10 @@ proc init*(T: type BufferedStream,
|
|||
asyncReader = AsyncStreamReader(nil)): BufferedStream =
|
||||
result.init result.buffer, reader, asyncReader
|
||||
|
||||
proc endPos*(s: InputStreamVar): int =
|
||||
# TODO This needs to use a VTable for `system.File` based streams
|
||||
s.bufferEndPos
|
||||
|
||||
proc syncRead(s: var ByteStream): bool =
|
||||
let bytesRead = s.reader(s.bufferStart, s.bufferSize)
|
||||
if bytesRead == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue