Package graphql.parser
Class MultiSourceReader
java.lang.Object
java.io.Reader
graphql.parser.MultiSourceReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
This reader allows you to read N number readers and combine them as one logical reader
however you can then map back to the underlying readers in terms of their source name
and the relative lines numbers.
It can also track all data in memory if you want to have all of the previous read data in
place at some point in time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getData()
int
int
getSourceAndLineFromOverallLine
(int overallLineNumber) This returns the source name and line number given an overall line number This is zeroes based likeLineNumberReader.getLineNumber()
static MultiSourceReader.Builder
int
read
(char[] cbuf, int off, int len) Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
Method Details
-
read
- Specified by:
read
in classReader
- Throws:
IOException
-
getSourceAndLineFromOverallLine
This returns the source name and line number given an overall line number This is zeroes based likeLineNumberReader.getLineNumber()
- Parameters:
overallLineNumber
- the over all line number- Returns:
- the source name and relative line number to that source
-
getLineNumber
public int getLineNumber()- Returns:
- the line number of the current source. This is zeroes based like
LineNumberReader.getLineNumber()
-
getSourceName
- Returns:
- The name of the current source
-
getOverallLineNumber
public int getOverallLineNumber()- Returns:
- the overall line number of the all the sources. This is zeroes based like
LineNumberReader.getLineNumber()
-
getData
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
newMultiSourceReader
-