@@ -747,8 +747,7 @@ public int writeBinary(Base64Variant b64variant,
747
747
*/
748
748
749
749
@ Override
750
- public void writeNumber (short s )
751
- throws IOException , JsonGenerationException
750
+ public void writeNumber (short s ) throws IOException
752
751
{
753
752
_verifyValueWrite (WRITE_NUMBER );
754
753
// up to 5 digits and possible minus sign
@@ -772,8 +771,7 @@ private final void _writeQuotedShort(short s) throws IOException {
772
771
}
773
772
774
773
@ Override
775
- public void writeNumber (int i )
776
- throws IOException , JsonGenerationException
774
+ public void writeNumber (int i ) throws IOException
777
775
{
778
776
_verifyValueWrite (WRITE_NUMBER );
779
777
// up to 10 digits and possible minus sign
@@ -798,8 +796,7 @@ private final void _writeQuotedInt(int i) throws IOException
798
796
}
799
797
800
798
@ Override
801
- public void writeNumber (long l )
802
- throws IOException , JsonGenerationException
799
+ public void writeNumber (long l ) throws IOException
803
800
{
804
801
_verifyValueWrite (WRITE_NUMBER );
805
802
if (_cfgNumbersAsStrings ) {
@@ -824,8 +821,7 @@ private final void _writeQuotedLong(long l) throws IOException
824
821
}
825
822
826
823
@ Override
827
- public void writeNumber (BigInteger value )
828
- throws IOException , JsonGenerationException
824
+ public void writeNumber (BigInteger value ) throws IOException
829
825
{
830
826
_verifyValueWrite (WRITE_NUMBER );
831
827
if (value == null ) {
@@ -839,13 +835,11 @@ public void writeNumber(BigInteger value)
839
835
840
836
841
837
@ Override
842
- public void writeNumber (double d )
843
- throws IOException , JsonGenerationException
838
+ public void writeNumber (double d ) throws IOException
844
839
{
845
840
if (_cfgNumbersAsStrings ||
846
- // [JACKSON-139]
847
841
(((Double .isNaN (d ) || Double .isInfinite (d ))
848
- && isEnabled ( Feature .QUOTE_NON_NUMERIC_NUMBERS )))) {
842
+ && Feature .QUOTE_NON_NUMERIC_NUMBERS . enabledIn ( _features )))) {
849
843
writeString (String .valueOf (d ));
850
844
return ;
851
845
}
@@ -855,13 +849,12 @@ && isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS)))) {
855
849
}
856
850
857
851
@ Override
858
- public void writeNumber (float f )
859
- throws IOException , JsonGenerationException
852
+ public void writeNumber (float f ) throws IOException
860
853
{
861
854
if (_cfgNumbersAsStrings ||
862
855
// [JACKSON-139]
863
856
(((Float .isNaN (f ) || Float .isInfinite (f ))
864
- && isEnabled ( Feature .QUOTE_NON_NUMERIC_NUMBERS )))) {
857
+ && Feature .QUOTE_NON_NUMERIC_NUMBERS . enabledIn ( _features )))) {
865
858
writeString (String .valueOf (f ));
866
859
return ;
867
860
}
@@ -871,26 +864,25 @@ && isEnabled(Feature.QUOTE_NON_NUMERIC_NUMBERS)))) {
871
864
}
872
865
873
866
@ Override
874
- public void writeNumber (BigDecimal value )
875
- throws IOException , JsonGenerationException
867
+ public void writeNumber (BigDecimal value ) throws IOException
876
868
{
877
869
// Don't really know max length for big decimal, no point checking
878
870
_verifyValueWrite (WRITE_NUMBER );
879
871
if (value == null ) {
880
872
_writeNull ();
881
873
} else if (_cfgNumbersAsStrings ) {
882
- String raw = isEnabled (Feature .WRITE_BIGDECIMAL_AS_PLAIN ) ? value .toPlainString () : value .toString ();
874
+ String raw = Feature .WRITE_BIGDECIMAL_AS_PLAIN .enabledIn (_features )
875
+ ? value .toPlainString () : value .toString ();
883
876
_writeQuotedRaw (raw );
884
- } else if (isEnabled ( Feature .WRITE_BIGDECIMAL_AS_PLAIN )) {
877
+ } else if (Feature .WRITE_BIGDECIMAL_AS_PLAIN . enabledIn ( _features )) {
885
878
writeRaw (value .toPlainString ());
886
879
} else {
887
880
writeRaw (value .toString ());
888
881
}
889
882
}
890
883
891
884
@ Override
892
- public void writeNumber (String encodedValue )
893
- throws IOException , JsonGenerationException
885
+ public void writeNumber (String encodedValue ) throws IOException
894
886
{
895
887
_verifyValueWrite (WRITE_NUMBER );
896
888
if (_cfgNumbersAsStrings ) {
@@ -914,8 +906,7 @@ private final void _writeQuotedRaw(String value) throws IOException
914
906
}
915
907
916
908
@ Override
917
- public void writeBoolean (boolean state )
918
- throws IOException , JsonGenerationException
909
+ public void writeBoolean (boolean state ) throws IOException
919
910
{
920
911
_verifyValueWrite (WRITE_BOOLEAN );
921
912
if ((_outputTail + 5 ) >= _outputEnd ) {
@@ -928,8 +919,7 @@ public void writeBoolean(boolean state)
928
919
}
929
920
930
921
@ Override
931
- public void writeNull ()
932
- throws IOException , JsonGenerationException
922
+ public void writeNull () throws IOException
933
923
{
934
924
_verifyValueWrite (WRITE_NULL );
935
925
_writeNull ();
@@ -1918,8 +1908,7 @@ private final int _outputRawMultiByteChar(int ch, char[] cbuf, int inputOffset,
1918
1908
return inputOffset ;
1919
1909
}
1920
1910
1921
- protected final void _outputSurrogates (int surr1 , int surr2 )
1922
- throws IOException
1911
+ protected final void _outputSurrogates (int surr1 , int surr2 ) throws IOException
1923
1912
{
1924
1913
int c = _decodeSurrogate (surr1 , surr2 );
1925
1914
if ((_outputTail + 4 ) > _outputEnd ) {
@@ -1945,21 +1934,26 @@ private final int _outputMultiByteChar(int ch, int outputPtr) throws IOException
1945
1934
{
1946
1935
byte [] bbuf = _outputBuffer ;
1947
1936
if (ch >= SURR1_FIRST && ch <= SURR2_LAST ) { // yes, outside of BMP; add an escape
1948
- bbuf [outputPtr ++] = BYTE_BACKSLASH ;
1949
- bbuf [outputPtr ++] = BYTE_u ;
1950
-
1951
- bbuf [outputPtr ++] = HEX_CHARS [(ch >> 12 ) & 0xF ];
1952
- bbuf [outputPtr ++] = HEX_CHARS [(ch >> 8 ) & 0xF ];
1953
- bbuf [outputPtr ++] = HEX_CHARS [(ch >> 4 ) & 0xF ];
1954
- bbuf [outputPtr ++] = HEX_CHARS [ch & 0xF ];
1937
+ // 23-Nov-2015, tatu: As per [core#223], may or may not want escapes;
1938
+ // it would be added here... but as things are, we do not have proper
1939
+ // access yet...
1940
+ // if (Feature.ESCAPE_UTF8_SURROGATES.enabledIn(_features)) {
1941
+ bbuf [outputPtr ++] = BYTE_BACKSLASH ;
1942
+ bbuf [outputPtr ++] = BYTE_u ;
1943
+
1944
+ bbuf [outputPtr ++] = HEX_CHARS [(ch >> 12 ) & 0xF ];
1945
+ bbuf [outputPtr ++] = HEX_CHARS [(ch >> 8 ) & 0xF ];
1946
+ bbuf [outputPtr ++] = HEX_CHARS [(ch >> 4 ) & 0xF ];
1947
+ bbuf [outputPtr ++] = HEX_CHARS [ch & 0xF ];
1948
+ // } else { ... }
1955
1949
} else {
1956
1950
bbuf [outputPtr ++] = (byte ) (0xe0 | (ch >> 12 ));
1957
1951
bbuf [outputPtr ++] = (byte ) (0x80 | ((ch >> 6 ) & 0x3f ));
1958
1952
bbuf [outputPtr ++] = (byte ) (0x80 | (ch & 0x3f ));
1959
1953
}
1960
1954
return outputPtr ;
1961
1955
}
1962
-
1956
+
1963
1957
private final void _writeNull () throws IOException
1964
1958
{
1965
1959
if ((_outputTail + 4 ) >= _outputEnd ) {
@@ -1974,8 +1968,7 @@ private final void _writeNull() throws IOException
1974
1968
*
1975
1969
* @param charToEscape Character to escape using escape sequence (\\uXXXX)
1976
1970
*/
1977
- private int _writeGenericEscape (int charToEscape , int outputPtr )
1978
- throws IOException
1971
+ private int _writeGenericEscape (int charToEscape , int outputPtr ) throws IOException
1979
1972
{
1980
1973
final byte [] bbuf = _outputBuffer ;
1981
1974
bbuf [outputPtr ++] = BYTE_BACKSLASH ;
0 commit comments