Package org.jboss.dmr.stream
Interface ModelReader
- All Superinterfaces:
AutoCloseable
DMR reader. Instances of this interface are not thread safe.
- Author:
- Richard Opalka
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free resources associated with this reader.Converts available context data tobig decimalinstance.Converts available context data tobig integerinstance.booleanConverts available context data toboolean.byte[]getBytes()Converts available context data tobytes.doubleConverts available context data todouble.Converts available context data toexpression.intgetInt()Converts available context data toint.longgetLong()Converts available context data tolong.Converts available context data toString.getType()Converts available context data tomodel type.booleanhasNext()Detects if there is next DMR parsing event available.booleanReturnstrueif current DMR parsing event is DMRbig decimal,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRbig integer,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRbooleantoken,falseotherwise.booleanisBytes()Returnstrueif current DMR parsing event is DMRbytes,falseotherwise.booleanisDouble()Returnstrueif current DMR parsing event is DMRdouble,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRexpression,falseotherwise.booleanisInt()Returnstrueif current DMR parsing event is DMRint,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRlist endtoken,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRlist starttoken,falseotherwise.booleanisLong()Returnstrueif current DMR parsing event is DMRlong,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRobject endtoken,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRobject starttoken,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRproperty endtoken,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRproperty starttoken,falseotherwise.booleanisString()Returnstrueif current DMR parsing event is DMRstring,falseotherwise.booleanisType()Returnstrueif current DMR parsing event is DMRtype,falseotherwise.booleanReturnstrueif current DMR parsing event is DMRundefinedtoken,falseotherwise.next()Returns next DMR parsing event.
-
Method Details
-
hasNext
boolean hasNext()Detects if there is next DMR parsing event available. Users should call this method before callingnext()method.- Returns:
trueif there are more DMR parsing events,falseotherwise
-
next
Returns next DMR parsing event. Users should callhasNext()before calling this method.- Returns:
- ModelEvent next event
- Throws:
IOException- if some I/O error occursModelException- if wrong DMR is detected
-
isObjectStart
boolean isObjectStart()Returnstrueif current DMR parsing event is DMRobject starttoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR object start token, false otherwise
-
isObjectEnd
boolean isObjectEnd()Returnstrueif current DMR parsing event is DMRobject endtoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR object end token, false otherwise
-
isPropertyStart
boolean isPropertyStart()Returnstrueif current DMR parsing event is DMRproperty starttoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR property start token, false otherwise
-
isPropertyEnd
boolean isPropertyEnd()Returnstrueif current DMR parsing event is DMRproperty endtoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR property end token, false otherwise
-
isListStart
boolean isListStart()Returnstrueif current DMR parsing event is DMRlist starttoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR list start token, false otherwise
-
isListEnd
boolean isListEnd()Returnstrueif current DMR parsing event is DMRlist endtoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR list end token, false otherwise
-
isUndefined
boolean isUndefined()Returnstrueif current DMR parsing event is DMRundefinedtoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR undefined token, false otherwise
-
isType
boolean isType()Returnstrueif current DMR parsing event is DMRtype,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR type, false otherwise
-
getType
ModelType getType()Converts available context data tomodel type. Users have to callnext()and should callisType()before calling this method.- Returns:
- type the parsing cursor is pointing to
- Throws:
IllegalStateException- if cursor isn't pointing to DMR type
-
isString
boolean isString()Returnstrueif current DMR parsing event is DMRstring,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR string, false otherwise
-
getString
String getString()Converts available context data toString. Users have to callnext()and should callisString()before calling this method.- Returns:
- string the parsing cursor is pointing to
- Throws:
IllegalStateException- if cursor isn't pointing to DMR String
-
isExpression
boolean isExpression()Returnstrueif current DMR parsing event is DMRexpression,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR expression, false otherwise
-
getExpression
String getExpression()Converts available context data toexpression. Users have to callnext()and should callisExpression()before calling this method.- Returns:
- expression the parsing cursor is pointing to
- Throws:
IllegalStateException- if cursor isn't pointing to DMR expression
-
isBytes
boolean isBytes()Returnstrueif current DMR parsing event is DMRbytes,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor position points to DMR bytes, false otherwise
-
getBytes
byte[] getBytes()Converts available context data tobytes. Users have to callnext()and should callisBytes()before calling this method.- Returns:
- bytes the parsing cursor is pointing to
- Throws:
IllegalStateException- if cursor isn't pointing to DMR Bytes
-
isBoolean
boolean isBoolean()Returnstrueif current DMR parsing event is DMRbooleantoken,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR boolean tokens, false otherwise
-
getBoolean
boolean getBoolean()Converts available context data toboolean. Users have to callnext()and should callisBoolean()before calling this method.- Returns:
- boolean value the parsing cursor is pointing to
- Throws:
IllegalStateException- if cursor isn't pointing to DMR boolean token
-
isInt
boolean isInt()Returnstrueif current DMR parsing event is DMRint,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR int, false otherwise
-
getInt
int getInt()Converts available context data toint. Users have to callnext()and should callisInt()before calling this method.- Returns:
- int value the parsing cursor is pointing to
-
isLong
boolean isLong()Returnstrueif current DMR parsing event is DMRlong,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR int, false otherwise
-
getLong
long getLong()Converts available context data tolong. Users have to callnext()and should callisLong()before calling this method.- Returns:
- long value the parsing cursor is pointing to
-
isDouble
boolean isDouble()Returnstrueif current DMR parsing event is DMRdouble,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR double, false otherwise
-
getDouble
double getDouble()Converts available context data todouble. Users have to callnext()and should callisDouble()before calling this method.- Returns:
- double value the parsing cursor is pointing to
-
isBigInteger
boolean isBigInteger()Returnstrueif current DMR parsing event is DMRbig integer,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR big integer, false otherwise
-
getBigInteger
BigInteger getBigInteger()Converts available context data tobig integerinstance. Users have to callnext()and should callisBigInteger()before calling this method.- Returns:
- big integer value the parsing cursor is pointing to
-
isBigDecimal
boolean isBigDecimal()Returnstrueif current DMR parsing event is DMRbig decimal,falseotherwise. Users have to callnext()before calling this method.- Returns:
- true if the parsing cursor points to DMR big decimal, false otherwise
-
getBigDecimal
BigDecimal getBigDecimal()Converts available context data tobig decimalinstance. Users have to callnext()and should callisBigDecimal()before calling this method.- Returns:
- big decimal value the parsing cursor is pointing to
-
close
Free resources associated with this reader. Never closes underlying output stream or reader.- Specified by:
closein interfaceAutoCloseable- Throws:
ModelException- if attempting to close this reader before reaching EOF.
-