You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/InputHandler.swift
+22-9Lines changed: 22 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ public protocol InputHandlerDelegate: class {
39
39
publicclassInputHandler{
40
40
41
41
publicstaticletdefaultByteLength=128
42
+
publicstaticletdefaultMaxRetries=3
42
43
43
44
/**
44
45
Delegate responsible for handling events from the input stream.
@@ -53,29 +54,33 @@ public class InputHandler {
53
54
*/
54
55
private(set)publicvarisOpen=false
55
56
privatevardata=Data()
57
+
privateletmaxRetries:Int
58
+
privatevarretries:Int=0
56
59
privateletfileHandle:FileHandle
57
60
privatevarparser:ImportParser
58
61
59
62
/**
60
63
- Parameter fileHandle: FileHandle for reading. InputHandler should be solely responsible for controlling seeking behavior during its lifetime. The FileHandle's seek position should be at the beginning.
61
64
- Parameter dialect: Dialect from which to parse against.
65
+
- Parameter maxRetries: Maximum number of allowed consecutive retries
Reads and parses a chunk of data from the FileHandle and directs output to its delegate.
87
92
88
-
- Parameter length: Maximum byte length of data to read.
89
-
- Return: Whether data was read. False indicates end of file.
93
+
- Parameter length: Maximum number of bytes of data to read.
94
+
- Returns: Whether data was read and to continue reading. Data may have been buffered. False indicates end of file.
90
95
- Throws: May throw anything the `InputHandlerDelegate` or `ImportParser` throws. If thrown, state should be assumed to be invalid and should be reset before attempting to read again.
0 commit comments