@@ -1898,7 +1898,7 @@ protected final void _finishToken() throws IOException
1898
1898
_binaryValue = _read7BitBinaryWithLength ();
1899
1899
return ;
1900
1900
case 7 : // binary, raw
1901
- _binaryValue = _finishRawBinary ();
1901
+ _binaryValue = _finishBinaryRaw ();
1902
1902
return ;
1903
1903
}
1904
1904
}
@@ -2441,14 +2441,16 @@ private final void _decodeLongUnicode() throws IOException
2441
2441
/**********************************************************************
2442
2442
*/
2443
2443
2444
- private final byte [] _finishRawBinary () throws IOException
2444
+ // Helper method for reading complete binary data value from "raw"
2445
+ // value (regular byte-per-byte)
2446
+ private final byte [] _finishBinaryRaw () throws IOException
2445
2447
{
2446
2448
int byteLen = _readUnsignedVInt ();
2447
2449
2448
2450
// 20-Mar-2021, tatu [dataformats-binary#260]: avoid eager allocation
2449
2451
// for very large content
2450
2452
if (byteLen > LONGEST_NON_CHUNKED_BINARY ) {
2451
- return _finishRawBinaryLong (byteLen );
2453
+ return _finishBinaryRawLong (byteLen );
2452
2454
}
2453
2455
2454
2456
// But use simpler, no intermediate buffering, for more compact cases
@@ -2478,7 +2480,7 @@ private final byte[] _finishRawBinary() throws IOException
2478
2480
}
2479
2481
2480
2482
// @since 2.12.3
2481
- protected byte [] _finishRawBinaryLong (final int expLen ) throws IOException
2483
+ protected byte [] _finishBinaryRawLong (final int expLen ) throws IOException
2482
2484
{
2483
2485
int left = expLen ;
2484
2486
@@ -2509,9 +2511,16 @@ protected byte[] _finishRawBinaryLong(final int expLen) throws IOException
2509
2511
private final byte [] _read7BitBinaryWithLength () throws IOException
2510
2512
{
2511
2513
int byteLen = _readUnsignedVInt ();
2512
- byte [] result = new byte [byteLen ];
2514
+
2515
+ // 20-Mar-2021, tatu [dataformats-binary#260]: avoid eager allocation
2516
+ // for very large content
2517
+ if (byteLen > LONGEST_NON_CHUNKED_BINARY ) {
2518
+ // return _finishBinary7BitLong(byteLen);
2519
+ }
2520
+
2521
+ final byte [] result = new byte [byteLen ];
2522
+ final int lastOkPtr = byteLen - 7 ;
2513
2523
int ptr = 0 ;
2514
- int lastOkPtr = byteLen - 7 ;
2515
2524
2516
2525
// first, read all 7-by-8 byte chunks
2517
2526
while (ptr <= lastOkPtr ) {
@@ -2555,10 +2564,16 @@ private final byte[] _read7BitBinaryWithLength() throws IOException
2555
2564
return result ;
2556
2565
}
2557
2566
2567
+ // @since 2.12.3
2568
+ protected byte [] _finishBinary7BitLong (final int expLen ) throws IOException
2569
+ {
2570
+ return null ;
2571
+ }
2572
+
2558
2573
/*
2559
- /**********************************************************
2574
+ /**********************************************************************
2560
2575
/* Internal methods, skipping
2561
- /**********************************************************
2576
+ /**********************************************************************
2562
2577
*/
2563
2578
2564
2579
/**
0 commit comments