Class DatatypeConverterImpl
- java.lang.Object
-
- jakarta.xml.bind.DatatypeConverterImpl
-
- All Implemented Interfaces:
DatatypeConverterInterface
final class DatatypeConverterImpl extends java.lang.Object implements DatatypeConverterInterface
This class is the Jakarta XML Binding CI's default implementation of theDatatypeConverterInterface.When client applications specify the use of the static print/parse methods in
DatatypeConverter, it will delegate to this class.This class is responsible for whitespace normalization.
- Since:
- JAXB 2.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDatatypeConverterImpl.CalendarFormatter
-
Field Summary
Fields Modifier and Type Field Description private static javax.xml.datatype.DatatypeFactorydatatypeFactoryprivate static byte[]decodeMapprivate static char[]encodeMapprivate static char[]hexCodeprivate static bytePADDINGstatic DatatypeConverterInterfacetheInstanceTo avoid re-creating instances, we cache one instance.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDatatypeConverterImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]_parseBase64Binary(java.lang.String text)static java.lang.Boolean_parseBoolean(java.lang.CharSequence literal)static byte_parseByte(java.lang.CharSequence literal)static java.util.GregorianCalendar_parseDateTime(java.lang.CharSequence s)static java.math.BigDecimal_parseDecimal(java.lang.CharSequence content)static double_parseDouble(java.lang.CharSequence _val)static float_parseFloat(java.lang.CharSequence _val)static int_parseInt(java.lang.CharSequence s)Faster but less robustString->intconversion.static java.math.BigInteger_parseInteger(java.lang.CharSequence s)static long_parseLong(java.lang.CharSequence s)static javax.xml.namespace.QName_parseQName(java.lang.CharSequence text, javax.xml.namespace.NamespaceContext nsc)static short_parseShort(java.lang.CharSequence s)static java.lang.String_printBase64Binary(byte[] input)static java.lang.String_printBase64Binary(byte[] input, int offset, int len)static int_printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr)Encodes a byte array into another byte array by first doing base64 encoding then encoding the result in ASCII.static int_printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr)Encodes a byte array into a char array by doing base64 encoding.static java.lang.String_printBoolean(boolean val)static java.lang.String_printByte(byte val)static java.lang.String_printDate(java.util.Calendar val)static java.lang.String_printDateTime(java.util.Calendar val)static java.lang.String_printDecimal(java.math.BigDecimal val)static java.lang.String_printDouble(double v)static java.lang.String_printFloat(float v)static java.lang.String_printInt(int val)static java.lang.String_printInteger(java.math.BigInteger val)static java.lang.String_printLong(long val)static java.lang.String_printQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)static java.lang.String_printShort(short val)static charencode(int i)static byteencodeByte(int i)private static intguessLength(java.lang.String text)computes the length of binary data speculatively.private static inthexToBin(char ch)private static byte[]initDecodeMap()private static char[]initEncodeMap()static java.lang.StringinstallHook(java.lang.String s)Just return the string passed as a parameter but installs an instance of this class as the DatatypeConverter implementation.private static booleanisDigitOrPeriodOrSign(char ch)java.lang.StringparseAnySimpleType(java.lang.String lexicalXSDAnySimpleType)Return a string containing the lexical representation of the simple type.byte[]parseBase64Binary(java.lang.String lexicalXSDBase64Binary)Converts the string argument into an array of bytes.booleanparseBoolean(java.lang.String lexicalXSDBoolean)Converts the string argument into a boolean value.byteparseByte(java.lang.String lexicalXSDByte)Converts the string argument into a byte value.java.util.CalendarparseDate(java.lang.String lexicalXSDDate)Converts the string argument into a Calendar value.java.util.CalendarparseDateTime(java.lang.String lexicalXSDDateTime)Converts the string argument into a Calendar value.java.math.BigDecimalparseDecimal(java.lang.String content)Converts the string argument into a BigDecimal value.doubleparseDouble(java.lang.String lexicalXSDDouble)Converts the string argument into a double value.floatparseFloat(java.lang.String lexicalXSDFloat)Converts the string argument into a float value.byte[]parseHexBinary(java.lang.String s)Converts the string argument into an array of bytes.intparseInt(java.lang.String s)Convert the string argument into an int value.java.math.BigIntegerparseInteger(java.lang.String lexicalXSDInteger)Convert the string argument into a BigInteger value.longparseLong(java.lang.String lexicalXSLong)Converts the string argument into a long value.javax.xml.namespace.QNameparseQName(java.lang.String lexicalXSDQName, javax.xml.namespace.NamespaceContext nsc)Converts the string argument into a QName value.shortparseShort(java.lang.String lexicalXSDShort)Converts the string argument into a short value.java.lang.StringparseString(java.lang.String lexicalXSDString)Convert the string argument into a string.java.util.CalendarparseTime(java.lang.String lexicalXSDTime)Converts the string argument into a Calendar value.longparseUnsignedInt(java.lang.String lexicalXSDUnsignedInt)Converts the string argument into a long value.intparseUnsignedShort(java.lang.String lexicalXSDUnsignedShort)Converts the string argument into an int value.java.lang.StringprintAnySimpleType(java.lang.String val)Converts a string value into a string.java.lang.StringprintBase64Binary(byte[] val)Converts an array of bytes into a string.java.lang.StringprintBoolean(boolean val)Converts a boolean value into a string.java.lang.StringprintByte(byte val)Converts a byte value into a string.java.lang.StringprintDate(java.util.Calendar val)Converts a Calendar value into a string.java.lang.StringprintDateTime(java.util.Calendar val)Converts a Calendar value into a string.java.lang.StringprintDecimal(java.math.BigDecimal val)Converts a BigDecimal value into a string.java.lang.StringprintDouble(double v)Converts a double value into a string.java.lang.StringprintFloat(float v)Converts a float value into a string.java.lang.StringprintHexBinary(byte[] data)Converts an array of bytes into a string.java.lang.StringprintInt(int val)Converts an int value into a string.java.lang.StringprintInteger(java.math.BigInteger val)Converts a BigInteger value into a string.java.lang.StringprintLong(long val)Converts a long value into a string.java.lang.StringprintQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)Converts a QName instance into a string.java.lang.StringprintShort(short val)Converts a short value into a string.java.lang.StringprintString(java.lang.String val)Converts the string argument into a string.java.lang.StringprintTime(java.util.Calendar val)Converts a Calendar value into a string.java.lang.StringprintUnsignedInt(long val)Converts a long value into a string.java.lang.StringprintUnsignedShort(int val)Converts an int value into a string.private static java.lang.CharSequenceremoveOptionalPlus(java.lang.CharSequence s)
-
-
-
Field Detail
-
theInstance
public static final DatatypeConverterInterface theInstance
To avoid re-creating instances, we cache one instance.
-
hexCode
private static final char[] hexCode
-
decodeMap
private static final byte[] decodeMap
-
PADDING
private static final byte PADDING
- See Also:
- Constant Field Values
-
encodeMap
private static final char[] encodeMap
-
datatypeFactory
private static final javax.xml.datatype.DatatypeFactory datatypeFactory
-
-
Method Detail
-
parseString
public java.lang.String parseString(java.lang.String lexicalXSDString)
Description copied from interface:DatatypeConverterInterfaceConvert the string argument into a string.- Specified by:
parseStringin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDString- A lexical representation of the XML Schema datatype xsd:string- Returns:
- A string that is the same as the input string.
-
parseInteger
public java.math.BigInteger parseInteger(java.lang.String lexicalXSDInteger)
Description copied from interface:DatatypeConverterInterfaceConvert the string argument into a BigInteger value.- Specified by:
parseIntegerin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDInteger- A string containing a lexical representation of xsd:integer.- Returns:
- A BigInteger value represented by the string argument.
-
_parseInteger
public static java.math.BigInteger _parseInteger(java.lang.CharSequence s)
-
printInteger
public java.lang.String printInteger(java.math.BigInteger val)
Description copied from interface:DatatypeConverterInterfaceConverts a BigInteger value into a string.- Specified by:
printIntegerin interfaceDatatypeConverterInterface- Parameters:
val- A BigInteger value- Returns:
- A string containing a lexical representation of xsd:integer
-
_printInteger
public static java.lang.String _printInteger(java.math.BigInteger val)
-
parseInt
public int parseInt(java.lang.String s)
Description copied from interface:DatatypeConverterInterfaceConvert the string argument into an int value.- Specified by:
parseIntin interfaceDatatypeConverterInterface- Parameters:
s- A string containing a lexical representation of xsd:int.- Returns:
- An int value represented byte the string argument.
-
_parseInt
public static int _parseInt(java.lang.CharSequence s)
Faster but less robustString->intconversion. Note that:- XML Schema allows '+', but
Integer.valueOf(String)is not. - XML Schema allows leading and trailing (but not in-between) whitespaces.
Integer.valueOf(String)doesn't allow any.
- XML Schema allows '+', but
-
parseLong
public long parseLong(java.lang.String lexicalXSLong)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a long value.- Specified by:
parseLongin interfaceDatatypeConverterInterface- Parameters:
lexicalXSLong- A string containing lexical representation of xsd:long.- Returns:
- A long value represented by the string argument.
-
_parseLong
public static long _parseLong(java.lang.CharSequence s)
-
parseShort
public short parseShort(java.lang.String lexicalXSDShort)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a short value.- Specified by:
parseShortin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDShort- A string containing lexical representation of xsd:short.- Returns:
- A short value represented by the string argument.
-
_parseShort
public static short _parseShort(java.lang.CharSequence s)
-
printShort
public java.lang.String printShort(short val)
Description copied from interface:DatatypeConverterInterfaceConverts a short value into a string.- Specified by:
printShortin interfaceDatatypeConverterInterface- Parameters:
val- A short value- Returns:
- A string containing a lexical representation of xsd:short
-
_printShort
public static java.lang.String _printShort(short val)
-
parseDecimal
public java.math.BigDecimal parseDecimal(java.lang.String content)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a BigDecimal value.- Specified by:
parseDecimalin interfaceDatatypeConverterInterface- Parameters:
content- A string containing lexical representation of xsd:decimal.- Returns:
- A BigDecimal value represented by the string argument.
-
_parseDecimal
public static java.math.BigDecimal _parseDecimal(java.lang.CharSequence content)
-
parseFloat
public float parseFloat(java.lang.String lexicalXSDFloat)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a float value.- Specified by:
parseFloatin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDFloat- A string containing lexical representation of xsd:float.- Returns:
- A float value represented by the string argument.
-
_parseFloat
public static float _parseFloat(java.lang.CharSequence _val)
-
printFloat
public java.lang.String printFloat(float v)
Description copied from interface:DatatypeConverterInterfaceConverts a float value into a string.- Specified by:
printFloatin interfaceDatatypeConverterInterface- Parameters:
v- A float value- Returns:
- A string containing a lexical representation of xsd:float
-
_printFloat
public static java.lang.String _printFloat(float v)
-
parseDouble
public double parseDouble(java.lang.String lexicalXSDDouble)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a double value.- Specified by:
parseDoublein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDDouble- A string containing lexical representation of xsd:double.- Returns:
- A double value represented by the string argument.
-
_parseDouble
public static double _parseDouble(java.lang.CharSequence _val)
-
parseBoolean
public boolean parseBoolean(java.lang.String lexicalXSDBoolean)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a boolean value.- Specified by:
parseBooleanin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDBoolean- A string containing lexical representation of xsd:boolean.- Returns:
- A boolean value represented by the string argument.
-
_parseBoolean
public static java.lang.Boolean _parseBoolean(java.lang.CharSequence literal)
-
printBoolean
public java.lang.String printBoolean(boolean val)
Description copied from interface:DatatypeConverterInterfaceConverts a boolean value into a string.- Specified by:
printBooleanin interfaceDatatypeConverterInterface- Parameters:
val- A boolean value- Returns:
- A string containing a lexical representation of xsd:boolean
-
_printBoolean
public static java.lang.String _printBoolean(boolean val)
-
parseByte
public byte parseByte(java.lang.String lexicalXSDByte)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a byte value.- Specified by:
parseBytein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDByte- A string containing lexical representation of xsd:byte.- Returns:
- A byte value represented by the string argument.
-
_parseByte
public static byte _parseByte(java.lang.CharSequence literal)
-
printByte
public java.lang.String printByte(byte val)
Description copied from interface:DatatypeConverterInterfaceConverts a byte value into a string.- Specified by:
printBytein interfaceDatatypeConverterInterface- Parameters:
val- A byte value- Returns:
- A string containing a lexical representation of xsd:byte
-
_printByte
public static java.lang.String _printByte(byte val)
-
parseQName
public javax.xml.namespace.QName parseQName(java.lang.String lexicalXSDQName, javax.xml.namespace.NamespaceContext nsc)Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a QName value.String parameter
lexicalXSDQnamemust conform to lexical value space specifed at XML Schema Part 2:Datatypes specification:QNames- Specified by:
parseQNamein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDQName- A string containing lexical representation of xsd:QName.nsc- A namespace context for interpreting a prefix within a QName.- Returns:
- A QName value represented by the string argument.
-
_parseQName
public static javax.xml.namespace.QName _parseQName(java.lang.CharSequence text, javax.xml.namespace.NamespaceContext nsc)- Returns:
- null if fails to convert.
-
parseDateTime
public java.util.Calendar parseDateTime(java.lang.String lexicalXSDDateTime)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a Calendar value.- Specified by:
parseDateTimein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDDateTime- A string containing lexical representation of xsd:datetime.- Returns:
- A Calendar object represented by the string argument.
-
_parseDateTime
public static java.util.GregorianCalendar _parseDateTime(java.lang.CharSequence s)
-
printDateTime
public java.lang.String printDateTime(java.util.Calendar val)
Description copied from interface:DatatypeConverterInterfaceConverts a Calendar value into a string.- Specified by:
printDateTimein interfaceDatatypeConverterInterface- Parameters:
val- A Calendar value- Returns:
- A string containing a lexical representation of xsd:dateTime
-
_printDateTime
public static java.lang.String _printDateTime(java.util.Calendar val)
-
parseBase64Binary
public byte[] parseBase64Binary(java.lang.String lexicalXSDBase64Binary)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into an array of bytes.- Specified by:
parseBase64Binaryin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDBase64Binary- A string containing lexical representation of xsd:base64Binary.- Returns:
- An array of bytes represented by the string argument.
-
parseHexBinary
public byte[] parseHexBinary(java.lang.String s)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into an array of bytes.- Specified by:
parseHexBinaryin interfaceDatatypeConverterInterface- Parameters:
s- A string containing lexical representation of xsd:hexBinary.- Returns:
- An array of bytes represented by the string argument.
-
hexToBin
private static int hexToBin(char ch)
-
printHexBinary
public java.lang.String printHexBinary(byte[] data)
Description copied from interface:DatatypeConverterInterfaceConverts an array of bytes into a string.- Specified by:
printHexBinaryin interfaceDatatypeConverterInterface- Parameters:
data- an array of bytes- Returns:
- A string containing a lexical representation of xsd:hexBinary
-
parseUnsignedInt
public long parseUnsignedInt(java.lang.String lexicalXSDUnsignedInt)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a long value.- Specified by:
parseUnsignedIntin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDUnsignedInt- A string containing lexical representation of xsd:unsignedInt.- Returns:
- A long value represented by the string argument.
-
printUnsignedInt
public java.lang.String printUnsignedInt(long val)
Description copied from interface:DatatypeConverterInterfaceConverts a long value into a string.- Specified by:
printUnsignedIntin interfaceDatatypeConverterInterface- Parameters:
val- A long value- Returns:
- A string containing a lexical representation of xsd:unsignedInt
-
parseUnsignedShort
public int parseUnsignedShort(java.lang.String lexicalXSDUnsignedShort)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into an int value.- Specified by:
parseUnsignedShortin interfaceDatatypeConverterInterface- Parameters:
lexicalXSDUnsignedShort- A string containing lexical representation of xsd:unsignedShort.- Returns:
- An int value represented by the string argument.
-
parseTime
public java.util.Calendar parseTime(java.lang.String lexicalXSDTime)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a Calendar value.- Specified by:
parseTimein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDTime- A string containing lexical representation of xsd:Time.- Returns:
- A Calendar value represented by the string argument.
-
printTime
public java.lang.String printTime(java.util.Calendar val)
Description copied from interface:DatatypeConverterInterfaceConverts a Calendar value into a string.- Specified by:
printTimein interfaceDatatypeConverterInterface- Parameters:
val- A Calendar value- Returns:
- A string containing a lexical representation of xsd:time
-
parseDate
public java.util.Calendar parseDate(java.lang.String lexicalXSDDate)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a Calendar value.- Specified by:
parseDatein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDDate- A string containing lexical representation of xsd:Date.- Returns:
- A Calendar value represented by the string argument.
-
printDate
public java.lang.String printDate(java.util.Calendar val)
Description copied from interface:DatatypeConverterInterfaceConverts a Calendar value into a string.- Specified by:
printDatein interfaceDatatypeConverterInterface- Parameters:
val- A Calendar value- Returns:
- A string containing a lexical representation of xsd:date
-
_printDate
public static java.lang.String _printDate(java.util.Calendar val)
-
parseAnySimpleType
public java.lang.String parseAnySimpleType(java.lang.String lexicalXSDAnySimpleType)
Description copied from interface:DatatypeConverterInterfaceReturn a string containing the lexical representation of the simple type.- Specified by:
parseAnySimpleTypein interfaceDatatypeConverterInterface- Parameters:
lexicalXSDAnySimpleType- A string containing lexical representation of the simple type.- Returns:
- A string containing the lexical representation of the simple type.
-
printString
public java.lang.String printString(java.lang.String val)
Description copied from interface:DatatypeConverterInterfaceConverts the string argument into a string.- Specified by:
printStringin interfaceDatatypeConverterInterface- Parameters:
val- A string value.- Returns:
- A string containing a lexical representation of xsd:string
-
printInt
public java.lang.String printInt(int val)
Description copied from interface:DatatypeConverterInterfaceConverts an int value into a string.- Specified by:
printIntin interfaceDatatypeConverterInterface- Parameters:
val- An int value- Returns:
- A string containing a lexical representation of xsd:int
-
_printInt
public static java.lang.String _printInt(int val)
-
printLong
public java.lang.String printLong(long val)
Description copied from interface:DatatypeConverterInterfaceConverts a long value into a string.- Specified by:
printLongin interfaceDatatypeConverterInterface- Parameters:
val- A long value- Returns:
- A string containing a lexical representation of xsd:long
-
_printLong
public static java.lang.String _printLong(long val)
-
printDecimal
public java.lang.String printDecimal(java.math.BigDecimal val)
Description copied from interface:DatatypeConverterInterfaceConverts a BigDecimal value into a string.- Specified by:
printDecimalin interfaceDatatypeConverterInterface- Parameters:
val- A BigDecimal value- Returns:
- A string containing a lexical representation of xsd:decimal
-
_printDecimal
public static java.lang.String _printDecimal(java.math.BigDecimal val)
-
printDouble
public java.lang.String printDouble(double v)
Description copied from interface:DatatypeConverterInterfaceConverts a double value into a string.- Specified by:
printDoublein interfaceDatatypeConverterInterface- Parameters:
v- A double value- Returns:
- A string containing a lexical representation of xsd:double
-
_printDouble
public static java.lang.String _printDouble(double v)
-
printQName
public java.lang.String printQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)Description copied from interface:DatatypeConverterInterfaceConverts a QName instance into a string.- Specified by:
printQNamein interfaceDatatypeConverterInterface- Parameters:
val- A QName valuensc- A namespace context for interpreting a prefix within a QName.- Returns:
- A string containing a lexical representation of QName
-
_printQName
public static java.lang.String _printQName(javax.xml.namespace.QName val, javax.xml.namespace.NamespaceContext nsc)
-
printBase64Binary
public java.lang.String printBase64Binary(byte[] val)
Description copied from interface:DatatypeConverterInterfaceConverts an array of bytes into a string.- Specified by:
printBase64Binaryin interfaceDatatypeConverterInterface- Parameters:
val- an array of bytes- Returns:
- A string containing a lexical representation of xsd:base64Binary
-
printUnsignedShort
public java.lang.String printUnsignedShort(int val)
Description copied from interface:DatatypeConverterInterfaceConverts an int value into a string.- Specified by:
printUnsignedShortin interfaceDatatypeConverterInterface- Parameters:
val- An int value- Returns:
- A string containing a lexical representation of xsd:unsignedShort
-
printAnySimpleType
public java.lang.String printAnySimpleType(java.lang.String val)
Description copied from interface:DatatypeConverterInterfaceConverts a string value into a string.- Specified by:
printAnySimpleTypein interfaceDatatypeConverterInterface- Parameters:
val- A string value- Returns:
- A string containing a lexical representation of xsd:AnySimpleType
-
installHook
public static java.lang.String installHook(java.lang.String s)
Just return the string passed as a parameter but installs an instance of this class as the DatatypeConverter implementation. Used from static fixed value initializers.
-
initDecodeMap
private static byte[] initDecodeMap()
-
guessLength
private static int guessLength(java.lang.String text)
computes the length of binary data speculatively.Our requirement is to create byte[] of the exact length to store the binary data. If we do this in a straight-forward way, it takes two passes over the data. Experiments show that this is a non-trivial overhead (35% or so is spent on the first pass in calculating the length.)
So the approach here is that we compute the length speculatively, without looking at the whole contents. The obtained speculative value is never less than the actual length of the binary data, but it may be bigger. So if the speculation goes wrong, we'll pay the cost of reallocation and buffer copying.
If the base64 text is tightly packed with no indentation nor illegal char (like what most web services produce), then the speculation of this method will be correct, so we get the performance benefit.
-
_parseBase64Binary
public static byte[] _parseBase64Binary(java.lang.String text)
- Parameters:
text- base64Binary data is likely to be long, and decoding requires each character to be accessed twice (once for counting length, another for decoding.) A benchmark showed that takingStringis faster, presumably because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast)
-
initEncodeMap
private static char[] initEncodeMap()
-
encode
public static char encode(int i)
-
encodeByte
public static byte encodeByte(int i)
-
_printBase64Binary
public static java.lang.String _printBase64Binary(byte[] input)
-
_printBase64Binary
public static java.lang.String _printBase64Binary(byte[] input, int offset, int len)
-
_printBase64Binary
public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr)Encodes a byte array into a char array by doing base64 encoding. The caller must supply a big enough buffer.- Returns:
- the value of
ptr+((len+2)/3)*4, which is the new offset in the output buffer where the further bytes should be placed.
-
_printBase64Binary
public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr)Encodes a byte array into another byte array by first doing base64 encoding then encoding the result in ASCII. The caller must supply a big enough buffer.- Returns:
- the value of
ptr+((len+2)/3)*4, which is the new offset in the output buffer where the further bytes should be placed.
-
removeOptionalPlus
private static java.lang.CharSequence removeOptionalPlus(java.lang.CharSequence s)
-
isDigitOrPeriodOrSign
private static boolean isDigitOrPeriodOrSign(char ch)
-
-