Other files ignored by Codecov
Showing 1 of 2 files from the diff.
@@ -191,6 +191,25 @@
Loading
191 | 191 | return false; |
|
192 | 192 | } |
|
193 | 193 | ||
194 | + | /** |
|
195 | + | * Tells whether there are at least the {@code length} of bytes between the |
|
196 | + | * current position and the limit. |
|
197 | + | * |
|
198 | + | * @return {@code true} if, and only if, there is at least the {@code length} of |
|
199 | + | * bytes remaining in this buffer array wrapper |
|
200 | + | */ |
|
201 | + | public boolean hasRemaining(long length) { |
|
202 | + | long remaining = 0; |
|
203 | + | ||
204 | + | for (int i = index; i < end; ++i) { |
|
205 | + | remaining += array[i].remaining(); |
|
206 | + | if (remaining >= length) { |
|
207 | + | return true; |
|
208 | + | } |
|
209 | + | } |
|
210 | + | return false; |
|
211 | + | } |
|
212 | + | ||
194 | 213 | /** |
|
195 | 214 | * Returns the number of bytes between the current position and the limit. |
|
196 | 215 | * |
@@ -391,8 +410,8 @@
Loading
391 | 410 | return ByteBuffer.wrap(data).order(b.order()); |
|
392 | 411 | } |
|
393 | 412 | ||
394 | - | private ByteBuffer buffer(int size, int[] index) { |
|
395 | - | int i = index[0]; |
|
413 | + | private ByteBuffer buffer(int size, long[] index) { |
|
414 | + | long i = index[0]; |
|
396 | 415 | ||
397 | 416 | if (i < 0) { |
|
398 | 417 | throw new IndexOutOfBoundsException(); |
@@ -411,7 +430,7 @@
Loading
411 | 430 | ||
412 | 431 | for (int j = 0; j < size; ++j) { |
|
413 | 432 | if (i < l) { |
|
414 | - | data[j] = buf.get(i++); |
|
433 | + | data[j] = buf.get((int) i++); |
|
415 | 434 | } else if (++b < end) { |
|
416 | 435 | buf = array[b]; |
|
417 | 436 | l = buf.limit(); |
@@ -563,6 +582,19 @@
Loading
563 | 582 | public byte get() { |
|
564 | 583 | return buffer().get(); |
|
565 | 584 | } |
|
585 | + | ||
586 | + | /** |
|
587 | + | * Relative get method that reads an unsigned value of the byte at this buffer |
|
588 | + | * array wrapper's current position, and then increments the position. |
|
589 | + | * |
|
590 | + | * @return An unsigned value of the byte at the buffer array wrapper's current |
|
591 | + | * position |
|
592 | + | * @throws BufferUnderflowException If the buffer array wrapper's current |
|
593 | + | * position is not smaller than its limit |
|
594 | + | */ |
|
595 | + | public int getUnsigned() { |
|
596 | + | return get() & 0xff; |
|
597 | + | } |
|
566 | 598 | ||
567 | 599 | /** |
|
568 | 600 | * Absolute get method that reads the byte at the given position. |
@@ -572,11 +604,25 @@
Loading
572 | 604 | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
573 | 605 | * the buffer array wrapper's limit |
|
574 | 606 | */ |
|
575 | - | public byte get(int position) { |
|
576 | - | int[] indexArray = new int[] { position }; |
|
577 | - | return buffer(1, indexArray).get(indexArray[0]); |
|
607 | + | public byte get(long position) { |
|
608 | + | long[] indexArray = new long[] { position }; |
|
609 | + | return buffer(1, indexArray).get((int) indexArray[0]); |
|
578 | 610 | } |
|
579 | 611 | ||
612 | + | /** |
|
613 | + | * Absolute get method that reads an unsigned value of the byte at the given |
|
614 | + | * position. |
|
615 | + | * |
|
616 | + | * @param position The position from which an unsigned value of the byte will be |
|
617 | + | * read |
|
618 | + | * @return An unsigned value of the byte at the given position |
|
619 | + | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
620 | + | * the buffer array wrapper's limit |
|
621 | + | */ |
|
622 | + | public int getUnsigned(long position) { |
|
623 | + | return get(position) & 0xff; |
|
624 | + | } |
|
625 | + | ||
580 | 626 | /** |
|
581 | 627 | * Relative get method for reading a char value. |
|
582 | 628 | * <p> |
@@ -609,9 +655,9 @@
Loading
609 | 655 | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
610 | 656 | * the buffer array wrapper's limit, minus one |
|
611 | 657 | */ |
|
612 | - | public char getChar(int position) { |
|
613 | - | int[] indexArray = new int[] { position }; |
|
614 | - | return buffer(2, indexArray).getChar(indexArray[0]); |
|
658 | + | public char getChar(long position) { |
|
659 | + | long[] indexArray = new long[] { position }; |
|
660 | + | return buffer(2, indexArray).getChar((int) indexArray[0]); |
|
615 | 661 | } |
|
616 | 662 | ||
617 | 663 | /** |
@@ -632,6 +678,25 @@
Loading
632 | 678 | return buffer(2).getShort(); |
|
633 | 679 | } |
|
634 | 680 | ||
681 | + | /** |
|
682 | + | * Relative get method for reading an unsigned short value. |
|
683 | + | * <p> |
|
684 | + | * It reads the next two bytes at this buffer array wrapper's current position, |
|
685 | + | * composing them into an unsigned short value according to the current byte |
|
686 | + | * order, and then increments the position by two. |
|
687 | + | * <p> |
|
688 | + | * NOTE: The current byte order is determined by the current byte order of the |
|
689 | + | * buffer pointed by the current position of this buffer array wrapper. |
|
690 | + | * |
|
691 | + | * @return The unsigned short value at the buffer array wrapper's current |
|
692 | + | * position |
|
693 | + | * @throws BufferUnderflowException If there are fewer than two bytes remaining |
|
694 | + | * in this buffer array wrapper |
|
695 | + | */ |
|
696 | + | public int getUnsignedShort() { |
|
697 | + | return getShort() & 0xffff; |
|
698 | + | } |
|
699 | + | ||
635 | 700 | /** |
|
636 | 701 | * Absolute get method for reading a short value. |
|
637 | 702 | * <p> |
@@ -646,11 +711,29 @@
Loading
646 | 711 | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
647 | 712 | * the buffer array wrapper's limit, minus one |
|
648 | 713 | */ |
|
649 | - | public short getShort(int position) { |
|
650 | - | int[] indexArray = new int[] { position }; |
|
651 | - | return buffer(2, indexArray).getShort(indexArray[0]); |
|
714 | + | public short getShort(long position) { |
|
715 | + | long[] indexArray = new long[] { position }; |
|
716 | + | return buffer(2, indexArray).getShort((int) indexArray[0]); |
|
652 | 717 | } |
|
653 | 718 | ||
719 | + | /** |
|
720 | + | * Absolute get method for reading an unsigned short value. |
|
721 | + | * <p> |
|
722 | + | * It reads two bytes at the given position, composing them into an unsigned |
|
723 | + | * short value according to the current byte order. |
|
724 | + | * <p> |
|
725 | + | * NOTE: The current byte order is determined by the current byte order of the |
|
726 | + | * buffer pointed by the given position. |
|
727 | + | * |
|
728 | + | * @param position The position from which the bytes will be read |
|
729 | + | * @return The unsigned short value at the given position |
|
730 | + | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
731 | + | * the buffer array wrapper's limit, minus one |
|
732 | + | */ |
|
733 | + | public int getUnsignedShort(long position) { |
|
734 | + | return getShort(position) & 0xffff; |
|
735 | + | } |
|
736 | + | ||
654 | 737 | /** |
|
655 | 738 | * Relative get method for reading an int value. |
|
656 | 739 | * <p> |
@@ -669,6 +752,24 @@
Loading
669 | 752 | return buffer(4).getInt(); |
|
670 | 753 | } |
|
671 | 754 | ||
755 | + | /** |
|
756 | + | * Relative get method for reading an unsigned int value. |
|
757 | + | * <p> |
|
758 | + | * It reads the next four bytes at this buffer array wrapper's current position, |
|
759 | + | * composing them into an unsigned int value according to the current byte |
|
760 | + | * order, and then increments the position by four. |
|
761 | + | * <p> |
|
762 | + | * NOTE: The current byte order is determined by the current byte order of the |
|
763 | + | * buffer pointed by the current position of this buffer array wrapper. |
|
764 | + | * |
|
765 | + | * @return The unsigned int value at the buffer array wrapper's current position |
|
766 | + | * @throws BufferUnderflowException If there are fewer than four bytes remaining |
|
767 | + | * in this buffer array wrapper |
|
768 | + | */ |
|
769 | + | public long getUnsignedInt() { |
|
770 | + | return getInt() & 0xffffffffL; |
|
771 | + | } |
|
772 | + | ||
672 | 773 | /** |
|
673 | 774 | * Absolute get method for reading an int value. |
|
674 | 775 | * <p> |
@@ -684,11 +785,30 @@
Loading
684 | 785 | * the buffer array wrapper's limit, minus |
|
685 | 786 | * three |
|
686 | 787 | */ |
|
687 | - | public int getInt(int position) { |
|
688 | - | int[] indexArray = new int[] { position }; |
|
689 | - | return buffer(4, indexArray).getInt(indexArray[0]); |
|
788 | + | public int getInt(long position) { |
|
789 | + | long[] indexArray = new long[] { position }; |
|
790 | + | return buffer(4, indexArray).getInt((int) indexArray[0]); |
|
690 | 791 | } |
|
691 | 792 | ||
793 | + | /** |
|
794 | + | * Absolute get method for reading an unsigned int value. |
|
795 | + | * <p> |
|
796 | + | * It reads four bytes at the given position, composing them into an unsigned |
|
797 | + | * int value according to the current byte order. |
|
798 | + | * <p> |
|
799 | + | * NOTE: The current byte order is determined by the current byte order of the |
|
800 | + | * buffer pointed by the given position. |
|
801 | + | * |
|
802 | + | * @param position The position from which the bytes will be read |
|
803 | + | * @return The unsigned int value at the given position |
|
804 | + | * @throws IndexOutOfBoundsException If position is negative or not smaller than |
|
805 | + | * the buffer array wrapper's limit, minus |
|
806 | + | * three |
|
807 | + | */ |
|
808 | + | public long getUnsignedInt(long position) { |
|
809 | + | return getInt(position) & 0xffffffffL; |
|
810 | + | } |
|
811 | + | ||
692 | 812 | /** |
|
693 | 813 | * Relative get method for reading a long value. |
|
694 | 814 | * <p> |
@@ -722,9 +842,9 @@
Loading
722 | 842 | * the buffer array wrapper's limit, minus |
|
723 | 843 | * seven |
|
724 | 844 | */ |
|
725 | - | public long getLong(int position) { |
|
726 | - | int[] indexArray = new int[] { position }; |
|
727 | - | return buffer(8, indexArray).getLong(indexArray[0]); |
|
845 | + | public long getLong(long position) { |
|
846 | + | long[] indexArray = new long[] { position }; |
|
847 | + | return buffer(8, indexArray).getLong((int) indexArray[0]); |
|
728 | 848 | } |
|
729 | 849 | ||
730 | 850 | /** |
@@ -760,9 +880,9 @@
Loading
760 | 880 | * the buffer array wrapper's limit, minus |
|
761 | 881 | * three |
|
762 | 882 | */ |
|
763 | - | public float getFloat(int position) { |
|
764 | - | int[] indexArray = new int[] { position }; |
|
765 | - | return buffer(4, indexArray).getFloat(indexArray[0]); |
|
883 | + | public float getFloat(long position) { |
|
884 | + | long[] indexArray = new long[] { position }; |
|
885 | + | return buffer(4, indexArray).getFloat((int) indexArray[0]); |
|
766 | 886 | } |
|
767 | 887 | ||
768 | 888 | /** |
@@ -798,9 +918,9 @@
Loading
798 | 918 | * the buffer array wrapper's limit, minus |
|
799 | 919 | * seven |
|
800 | 920 | */ |
|
801 | - | public double getDouble(int position) { |
|
802 | - | int[] indexArray = new int[] { position }; |
|
803 | - | return buffer(8, indexArray).getDouble(indexArray[0]); |
|
921 | + | public double getDouble(long position) { |
|
922 | + | long[] indexArray = new long[] { position }; |
|
923 | + | return buffer(8, indexArray).getDouble((int) indexArray[0]); |
|
804 | 924 | } |
|
805 | 925 | ||
806 | 926 | static class OneByteBufferArray extends ByteBufferArray { |
@@ -829,6 +949,11 @@
Loading
829 | 949 | return buffer.hasRemaining(); |
|
830 | 950 | } |
|
831 | 951 | ||
952 | + | @Override |
|
953 | + | public boolean hasRemaining(long length) { |
|
954 | + | return buffer.remaining() >= length; |
|
955 | + | } |
|
956 | + | ||
832 | 957 | @Override |
|
833 | 958 | public long remaining() { |
|
834 | 959 | return buffer.remaining(); |
@@ -904,8 +1029,8 @@
Loading
904 | 1029 | } |
|
905 | 1030 | ||
906 | 1031 | @Override |
|
907 | - | public byte get(int position) { |
|
908 | - | return buffer.get(position); |
|
1032 | + | public byte get(long position) { |
|
1033 | + | return buffer.get((int) position); |
|
909 | 1034 | } |
|
910 | 1035 | ||
911 | 1036 | @Override |
@@ -914,8 +1039,8 @@
Loading
914 | 1039 | } |
|
915 | 1040 | ||
916 | 1041 | @Override |
|
917 | - | public char getChar(int position) { |
|
918 | - | return buffer.getChar(position); |
|
1042 | + | public char getChar(long position) { |
|
1043 | + | return buffer.getChar((int) position); |
|
919 | 1044 | } |
|
920 | 1045 | ||
921 | 1046 | @Override |
@@ -924,8 +1049,8 @@
Loading
924 | 1049 | } |
|
925 | 1050 | ||
926 | 1051 | @Override |
|
927 | - | public short getShort(int position) { |
|
928 | - | return buffer.getShort(position); |
|
1052 | + | public short getShort(long position) { |
|
1053 | + | return buffer.getShort((int) position); |
|
929 | 1054 | } |
|
930 | 1055 | ||
931 | 1056 | @Override |
@@ -934,8 +1059,8 @@
Loading
934 | 1059 | } |
|
935 | 1060 | ||
936 | 1061 | @Override |
|
937 | - | public int getInt(int position) { |
|
938 | - | return buffer.getInt(position); |
|
1062 | + | public int getInt(long position) { |
|
1063 | + | return buffer.getInt((int) position); |
|
939 | 1064 | } |
|
940 | 1065 | ||
941 | 1066 | @Override |
@@ -944,8 +1069,8 @@
Loading
944 | 1069 | } |
|
945 | 1070 | ||
946 | 1071 | @Override |
|
947 | - | public long getLong(int position) { |
|
948 | - | return buffer.getLong(position); |
|
1072 | + | public long getLong(long position) { |
|
1073 | + | return buffer.getLong((int) position); |
|
949 | 1074 | } |
|
950 | 1075 | ||
951 | 1076 | @Override |
@@ -954,8 +1079,8 @@
Loading
954 | 1079 | } |
|
955 | 1080 | ||
956 | 1081 | @Override |
|
957 | - | public float getFloat(int position) { |
|
958 | - | return buffer.getFloat(position); |
|
1082 | + | public float getFloat(long position) { |
|
1083 | + | return buffer.getFloat((int) position); |
|
959 | 1084 | } |
|
960 | 1085 | ||
961 | 1086 | @Override |
@@ -964,8 +1089,8 @@
Loading
964 | 1089 | } |
|
965 | 1090 | ||
966 | 1091 | @Override |
|
967 | - | public double getDouble(int position) { |
|
968 | - | return buffer.getDouble(position); |
|
1092 | + | public double getDouble(long position) { |
|
1093 | + | return buffer.getDouble((int) position); |
|
969 | 1094 | } |
|
970 | 1095 | ||
971 | 1096 | } |
Files | Coverage |
---|---|
snf4j-core-log4j2/src/main/java/org/snf4j/core/logger/impl | 96.66% |
snf4j-core-slf4j/src/main/java/org/snf4j/core/logger/impl | 96.66% |
snf4j-core/src/main/java/org/snf4j/core | 98.09% |
snf4j-sctp/src/main/java/org/snf4j/core | 98.58% |
snf4j-websocket/src/main/java/org/snf4j/websocket | 99.37% |
Project Totals (242 files) | 98.31% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.