7
7
import java .io .*;
8
8
import java .math .BigDecimal ;
9
9
import java .math .BigInteger ;
10
+ import java .util .Objects ;
10
11
11
12
import com .fasterxml .jackson .core .JsonParser .NumberType ;
12
13
import com .fasterxml .jackson .core .io .CharacterEscapes ;
@@ -514,9 +515,7 @@ public void setSchema(FormatSchema schema) {
514
515
*/
515
516
public void writeArray (int [] array , int offset , int length ) throws IOException
516
517
{
517
- if (array == null ) {
518
- throw new IllegalArgumentException ("null array" );
519
- }
518
+ Objects .requireNonNull (array , "null 'array' argument" );
520
519
_verifyOffsets (array .length , offset , length );
521
520
writeStartArray (array , length );
522
521
for (int i = offset , end = offset +length ; i < end ; ++i ) {
@@ -536,9 +535,7 @@ public void writeArray(int[] array, int offset, int length) throws IOException
536
535
*/
537
536
public void writeArray (long [] array , int offset , int length ) throws IOException
538
537
{
539
- if (array == null ) {
540
- throw new IllegalArgumentException ("null array" );
541
- }
538
+ Objects .requireNonNull (array , "null 'array' argument" );
542
539
_verifyOffsets (array .length , offset , length );
543
540
writeStartArray (array , length );
544
541
for (int i = offset , end = offset +length ; i < end ; ++i ) {
@@ -558,9 +555,7 @@ public void writeArray(long[] array, int offset, int length) throws IOException
558
555
*/
559
556
public void writeArray (double [] array , int offset , int length ) throws IOException
560
557
{
561
- if (array == null ) {
562
- throw new IllegalArgumentException ("null array" );
563
- }
558
+ Objects .requireNonNull (array , "null 'array' argument" );
564
559
_verifyOffsets (array .length , offset , length );
565
560
writeStartArray (array , length );
566
561
for (int i = offset , end = offset +length ; i < end ; ++i ) {
@@ -574,17 +569,13 @@ public void writeArray(double[] array, int offset, int length) throws IOExceptio
574
569
* array (sequence of {@link JsonToken#START_ARRAY}, zero or
575
570
* more {@link JsonToken#VALUE_STRING}, {@link JsonToken#END_ARRAY})
576
571
*
577
- * @since 2.11
578
- *
579
572
* @param array Array that contains values to write
580
573
* @param offset Offset of the first element to write, within array
581
574
* @param length Number of elements in array to write, from `offset` to `offset + len - 1`
582
575
*/
583
576
public void writeArray (String [] array , int offset , int length ) throws IOException
584
577
{
585
- if (array == null ) {
586
- throw new IllegalArgumentException ("null array" );
587
- }
578
+ Objects .requireNonNull (array , "null 'array' argument" );
588
579
_verifyOffsets (array .length , offset , length );
589
580
writeStartArray (array , length );
590
581
for (int i = offset , end = offset +length ; i < end ; ++i ) {
0 commit comments