Package com.amazon.ion.impl
Class _Private_IonTextAppender
- java.lang.Object
-
- com.amazon.ion.impl._Private_IonTextAppender
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public final class _Private_IonTextAppender extends java.lang.Object implements java.io.Closeable, java.io.FlushableNOT FOR APPLICATION USE!Generic text sink that enables optimized output of both ASCII and UTF-16.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean[]OPERATOR_CHAR_FLAGSstatic java.lang.String[]ZERO_PADDING
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendAscii(char c)voidappendAscii(java.lang.CharSequence csq)voidappendAscii(java.lang.CharSequence csq, int start, int end)voidappendUtf16(char c)voidappendUtf16Surrogate(char leadSurrogate, char trailSurrogate)voidclose()voidflush()static _Private_IonTextAppenderforAppendable(java.lang.Appendable out)Doesn't escape non-ASCII characters.static _Private_IonTextAppenderforAppendable(java.lang.Appendable out, java.nio.charset.Charset charset)static _Private_IonTextAppenderforFastAppendable(_Private_FastAppendable out, java.nio.charset.Charset charset)static _Private_IonTextAppenderforOutputStream(java.io.OutputStream out, java.nio.charset.Charset charset)static booleanisIdentifierKeyword(java.lang.CharSequence text)Determines whether the given text matches one of the Ion identifier keywordsnull,true, orfalse.static booleanisIdentifierPart(int codePoint)static booleanisIdentifierStart(int codePoint)static booleanisOperatorPart(int codePoint)voidprintBlob(_Private_IonTextWriterBuilder _options, byte[] value, int start, int len)voidprintClob(_Private_IonTextWriterBuilder _options, byte[] value, int start, int len)voidprintDecimal(_Private_IonTextWriterBuilder _options, java.math.BigDecimal value)voidprintFloat(_Private_IonTextWriterBuilder _options, double value)voidprintFloat(_Private_IonTextWriterBuilder _options, java.lang.Double value)voidprintInt(long value)voidprintInt(java.math.BigInteger value)voidprintJsonString(java.lang.CharSequence text)Print a JSON stringvoidprintLongString(java.lang.CharSequence text)Print an Ion triple-quoted stringvoidprintQuotedSymbol(java.lang.CharSequence text)Print single-quoted Ion Symbol typevoidprintString(java.lang.CharSequence text)Print an Ion String typevoidprintSymbol(java.lang.CharSequence text)Print an Ion Symbol type.static booleansymbolNeedsQuoting(java.lang.CharSequence symbol, boolean quoteOperators)Determines whether the text of a symbol requires (single) quotes.
-
-
-
Method Detail
-
isIdentifierStart
public static boolean isIdentifierStart(int codePoint)
-
isIdentifierPart
public static boolean isIdentifierPart(int codePoint)
-
isOperatorPart
public static boolean isOperatorPart(int codePoint)
-
forFastAppendable
public static _Private_IonTextAppender forFastAppendable(_Private_FastAppendable out, java.nio.charset.Charset charset)
-
forAppendable
public static _Private_IonTextAppender forAppendable(java.lang.Appendable out, java.nio.charset.Charset charset)
- Parameters:
charset- must be eitherIonTextWriterBuilder.ASCIIorIonTextWriterBuilder.UTF8. When ASCII is used, all non-ASCII characters will be escaped. Otherwise, only select code points will be escaped.
-
forAppendable
public static _Private_IonTextAppender forAppendable(java.lang.Appendable out)
Doesn't escape non-ASCII characters.
-
forOutputStream
public static _Private_IonTextAppender forOutputStream(java.io.OutputStream out, java.nio.charset.Charset charset)
- Parameters:
charset- must be eitherIonTextWriterBuilder.ASCIIorIonTextWriterBuilder.UTF8. When ASCII is used, all non-ASCII characters will be escaped. Otherwise, only select code points will be escaped.
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
appendAscii
public void appendAscii(char c) throws java.io.IOException- Throws:
java.io.IOException
-
appendAscii
public void appendAscii(java.lang.CharSequence csq) throws java.io.IOException- Throws:
java.io.IOException
-
appendAscii
public void appendAscii(java.lang.CharSequence csq, int start, int end) throws java.io.IOException- Throws:
java.io.IOException
-
appendUtf16
public void appendUtf16(char c) throws java.io.IOException- Throws:
java.io.IOException
-
appendUtf16Surrogate
public void appendUtf16Surrogate(char leadSurrogate, char trailSurrogate) throws java.io.IOException- Throws:
java.io.IOException
-
printString
public final void printString(java.lang.CharSequence text) throws java.io.IOExceptionPrint an Ion String type- Parameters:
text-- Throws:
java.io.IOException
-
printLongString
public final void printLongString(java.lang.CharSequence text) throws java.io.IOExceptionPrint an Ion triple-quoted string- Parameters:
text-- Throws:
java.io.IOException
-
printJsonString
public final void printJsonString(java.lang.CharSequence text) throws java.io.IOExceptionPrint a JSON string- Parameters:
text-- Throws:
java.io.IOException
-
isIdentifierKeyword
public static boolean isIdentifierKeyword(java.lang.CharSequence text)
Determines whether the given text matches one of the Ion identifier keywordsnull,true, orfalse.This does not check for non-identifier keywords such as
null.int.- Parameters:
text- the symbol to check.- Returns:
trueif the text is an identifier keyword.
-
symbolNeedsQuoting
public static boolean symbolNeedsQuoting(java.lang.CharSequence symbol, boolean quoteOperators)Determines whether the text of a symbol requires (single) quotes.- Parameters:
symbol- must be a non-empty string.quoteOperators- indicates whether the caller wants operators to be quoted; iftruethen operator symbols like!=will returntrue. has looser quoting requirements than other containers.- Returns:
trueif the given symbol requires quoting.- Throws:
java.lang.NullPointerException- ifsymbolisnull.
-
printSymbol
public final void printSymbol(java.lang.CharSequence text) throws java.io.IOExceptionPrint an Ion Symbol type. This method will check if symbol needs quoting- Parameters:
text-- Throws:
java.io.IOException
-
printQuotedSymbol
public final void printQuotedSymbol(java.lang.CharSequence text) throws java.io.IOExceptionPrint single-quoted Ion Symbol type- Parameters:
text-- Throws:
java.io.IOException
-
printInt
public void printInt(long value) throws java.io.IOException- Throws:
java.io.IOException
-
printInt
public void printInt(java.math.BigInteger value) throws java.io.IOException- Throws:
java.io.IOException
-
printDecimal
public void printDecimal(_Private_IonTextWriterBuilder _options, java.math.BigDecimal value) throws java.io.IOException
- Throws:
java.io.IOException
-
printFloat
public void printFloat(_Private_IonTextWriterBuilder _options, double value) throws java.io.IOException
- Throws:
java.io.IOException
-
printFloat
public void printFloat(_Private_IonTextWriterBuilder _options, java.lang.Double value) throws java.io.IOException
- Throws:
java.io.IOException
-
printBlob
public void printBlob(_Private_IonTextWriterBuilder _options, byte[] value, int start, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
printClob
public void printClob(_Private_IonTextWriterBuilder _options, byte[] value, int start, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
-