1717 */
1818package io .netty .buffer ;
1919
20- import io .netty .util .internal .PlatformDependent ;
21-
2220import java .io .IOException ;
2321import java .io .InputStream ;
2422import java .io .OutputStream ;
3028import java .util .concurrent .atomic .AtomicInteger ;
3129import java .util .concurrent .atomic .AtomicLong ;
3230
31+ import org .apache .arrow .memory .AllocationManager .BufferLedger ;
3332import org .apache .arrow .memory .BaseAllocator ;
33+ import org .apache .arrow .memory .BaseAllocator .Verbosity ;
3434import org .apache .arrow .memory .BoundsChecking ;
3535import org .apache .arrow .memory .BufferAllocator ;
3636import org .apache .arrow .memory .BufferManager ;
37- import org .apache .arrow .memory .AllocationManager .BufferLedger ;
38- import org .apache .arrow .memory .BaseAllocator .Verbosity ;
3937import org .apache .arrow .memory .util .HistoricalLog ;
4038
4139import com .google .common .base .Preconditions ;
4240
41+ import io .netty .util .internal .PlatformDependent ;
42+
4343public final class ArrowBuf extends AbstractByteBuf implements AutoCloseable {
4444 private static final org .slf4j .Logger logger = org .slf4j .LoggerFactory .getLogger (ArrowBuf .class );
4545
@@ -307,7 +307,7 @@ public ByteOrder order() {
307307 }
308308
309309 @ Override
310- public ByteBuf order (ByteOrder endianness ) {
310+ public ArrowBuf order (ByteOrder endianness ) {
311311 return this ;
312312 }
313313
@@ -344,7 +344,7 @@ public ByteBuf copy(int index, int length) {
344344 }
345345
346346 @ Override
347- public ByteBuf slice () {
347+ public ArrowBuf slice () {
348348 return slice (readerIndex (), readableBytes ());
349349 }
350350
@@ -467,7 +467,7 @@ public boolean equals(Object obj) {
467467 }
468468
469469 @ Override
470- public ByteBuf retain (int increment ) {
470+ public ArrowBuf retain (int increment ) {
471471 Preconditions .checkArgument (increment > 0 , "retain(%d) argument is not positive" , increment );
472472
473473 if (isEmpty ) {
@@ -484,7 +484,7 @@ public ByteBuf retain(int increment) {
484484 }
485485
486486 @ Override
487- public ByteBuf retain () {
487+ public ArrowBuf retain () {
488488 return retain (1 );
489489 }
490490
@@ -535,109 +535,109 @@ public short getShort(int index) {
535535 }
536536
537537 @ Override
538- public ByteBuf setShort (int index , int value ) {
538+ public ArrowBuf setShort (int index , int value ) {
539539 chk (index , 2 );
540540 PlatformDependent .putShort (addr (index ), (short ) value );
541541 return this ;
542542 }
543543
544544 @ Override
545- public ByteBuf setInt (int index , int value ) {
545+ public ArrowBuf setInt (int index , int value ) {
546546 chk (index , 4 );
547547 PlatformDependent .putInt (addr (index ), value );
548548 return this ;
549549 }
550550
551551 @ Override
552- public ByteBuf setLong (int index , long value ) {
552+ public ArrowBuf setLong (int index , long value ) {
553553 chk (index , 8 );
554554 PlatformDependent .putLong (addr (index ), value );
555555 return this ;
556556 }
557557
558558 @ Override
559- public ByteBuf setChar (int index , int value ) {
559+ public ArrowBuf setChar (int index , int value ) {
560560 chk (index , 2 );
561561 PlatformDependent .putShort (addr (index ), (short ) value );
562562 return this ;
563563 }
564564
565565 @ Override
566- public ByteBuf setFloat (int index , float value ) {
566+ public ArrowBuf setFloat (int index , float value ) {
567567 chk (index , 4 );
568568 PlatformDependent .putInt (addr (index ), Float .floatToRawIntBits (value ));
569569 return this ;
570570 }
571571
572572 @ Override
573- public ByteBuf setDouble (int index , double value ) {
573+ public ArrowBuf setDouble (int index , double value ) {
574574 chk (index , 8 );
575575 PlatformDependent .putLong (addr (index ), Double .doubleToRawLongBits (value ));
576576 return this ;
577577 }
578578
579579 @ Override
580- public ByteBuf writeShort (int value ) {
580+ public ArrowBuf writeShort (int value ) {
581581 ensure (2 );
582582 PlatformDependent .putShort (addr (writerIndex ), (short ) value );
583583 writerIndex += 2 ;
584584 return this ;
585585 }
586586
587587 @ Override
588- public ByteBuf writeInt (int value ) {
588+ public ArrowBuf writeInt (int value ) {
589589 ensure (4 );
590590 PlatformDependent .putInt (addr (writerIndex ), value );
591591 writerIndex += 4 ;
592592 return this ;
593593 }
594594
595595 @ Override
596- public ByteBuf writeLong (long value ) {
596+ public ArrowBuf writeLong (long value ) {
597597 ensure (8 );
598598 PlatformDependent .putLong (addr (writerIndex ), value );
599599 writerIndex += 8 ;
600600 return this ;
601601 }
602602
603603 @ Override
604- public ByteBuf writeChar (int value ) {
604+ public ArrowBuf writeChar (int value ) {
605605 ensure (2 );
606606 PlatformDependent .putShort (addr (writerIndex ), (short ) value );
607607 writerIndex += 2 ;
608608 return this ;
609609 }
610610
611611 @ Override
612- public ByteBuf writeFloat (float value ) {
612+ public ArrowBuf writeFloat (float value ) {
613613 ensure (4 );
614614 PlatformDependent .putInt (addr (writerIndex ), Float .floatToRawIntBits (value ));
615615 writerIndex += 4 ;
616616 return this ;
617617 }
618618
619619 @ Override
620- public ByteBuf writeDouble (double value ) {
620+ public ArrowBuf writeDouble (double value ) {
621621 ensure (8 );
622622 PlatformDependent .putLong (addr (writerIndex ), Double .doubleToRawLongBits (value ));
623623 writerIndex += 8 ;
624624 return this ;
625625 }
626626
627627 @ Override
628- public ByteBuf getBytes (int index , byte [] dst , int dstIndex , int length ) {
628+ public ArrowBuf getBytes (int index , byte [] dst , int dstIndex , int length ) {
629629 udle .getBytes (index + offset , dst , dstIndex , length );
630630 return this ;
631631 }
632632
633633 @ Override
634- public ByteBuf getBytes (int index , ByteBuffer dst ) {
634+ public ArrowBuf getBytes (int index , ByteBuffer dst ) {
635635 udle .getBytes (index + offset , dst );
636636 return this ;
637637 }
638638
639639 @ Override
640- public ByteBuf setByte (int index , int value ) {
640+ public ArrowBuf setByte (int index , int value ) {
641641 chk (index , 1 );
642642 PlatformDependent .putByte (addr (index ), (byte ) value );
643643 return this ;
@@ -699,13 +699,13 @@ protected void _setLong(int index, long value) {
699699 }
700700
701701 @ Override
702- public ByteBuf getBytes (int index , ByteBuf dst , int dstIndex , int length ) {
702+ public ArrowBuf getBytes (int index , ByteBuf dst , int dstIndex , int length ) {
703703 udle .getBytes (index + offset , dst , dstIndex , length );
704704 return this ;
705705 }
706706
707707 @ Override
708- public ByteBuf getBytes (int index , OutputStream out , int length ) throws IOException {
708+ public ArrowBuf getBytes (int index , OutputStream out , int length ) throws IOException {
709709 udle .getBytes (index + offset , out , length );
710710 return this ;
711711 }
@@ -724,12 +724,12 @@ public int getBytes(int index, GatheringByteChannel out, int length) throws IOEx
724724 }
725725
726726 @ Override
727- public ByteBuf setBytes (int index , ByteBuf src , int srcIndex , int length ) {
727+ public ArrowBuf setBytes (int index , ByteBuf src , int srcIndex , int length ) {
728728 udle .setBytes (index + offset , src , srcIndex , length );
729729 return this ;
730730 }
731731
732- public ByteBuf setBytes (int index , ByteBuffer src , int srcIndex , int length ) {
732+ public ArrowBuf setBytes (int index , ByteBuffer src , int srcIndex , int length ) {
733733 if (src .isDirect ()) {
734734 checkIndex (index , length );
735735 PlatformDependent .copyMemory (PlatformDependent .directBufferAddress (src ) + srcIndex , this .memoryAddress () + index ,
@@ -749,13 +749,13 @@ public ByteBuf setBytes(int index, ByteBuffer src, int srcIndex, int length) {
749749 }
750750
751751 @ Override
752- public ByteBuf setBytes (int index , byte [] src , int srcIndex , int length ) {
752+ public ArrowBuf setBytes (int index , byte [] src , int srcIndex , int length ) {
753753 udle .setBytes (index + offset , src , srcIndex , length );
754754 return this ;
755755 }
756756
757757 @ Override
758- public ByteBuf setBytes (int index , ByteBuffer src ) {
758+ public ArrowBuf setBytes (int index , ByteBuffer src ) {
759759 udle .setBytes (index + offset , src );
760760 return this ;
761761 }
@@ -860,4 +860,17 @@ public void print(StringBuilder sb, int indent, Verbosity verbosity) {
860860 }
861861 }
862862
863+ @ Override
864+ public ArrowBuf readerIndex (int readerIndex ) {
865+ super .readerIndex (readerIndex );
866+ return this ;
867+ }
868+
869+ @ Override
870+ public ArrowBuf writerIndex (int writerIndex ) {
871+ super .writerIndex (writerIndex );
872+ return this ;
873+ }
874+
875+
863876}
0 commit comments