src/java.base/share/classes/java/nio/Bits.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff src/java.base/share/classes/java/nio

src/java.base/share/classes/java/nio/Bits.java

Print this page




 802             long size = (length > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : length;
 803             unsafe.copyMemory(null, srcAddr, dst, offset, size);
 804             length -= size;
 805             srcAddr += size;
 806             offset += size;
 807         }
 808     }
 809 
 810     static void copyFromCharArray(Object src, long srcPos, long dstAddr,
 811                                   long length)
 812     {
 813         copyFromShortArray(src, srcPos, dstAddr, length);
 814     }
 815 
 816     static void copyToCharArray(long srcAddr, Object dst, long dstPos,
 817                                 long length)
 818     {
 819         copyToShortArray(srcAddr, dst, dstPos, length);
 820     }
 821 












 822     static native void copyFromShortArray(Object src, long srcPos, long dstAddr,
 823                                           long length);













 824     static native void copyToShortArray(long srcAddr, Object dst, long dstPos,
 825                                         long length);
 826 












 827     static native void copyFromIntArray(Object src, long srcPos, long dstAddr,
 828                                         long length);













 829     static native void copyToIntArray(long srcAddr, Object dst, long dstPos,
 830                                       long length);
 831 












 832     static native void copyFromLongArray(Object src, long srcPos, long dstAddr,
 833                                          long length);













 834     static native void copyToLongArray(long srcAddr, Object dst, long dstPos,
 835                                        long length);
 836 
 837 }


 802             long size = (length > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : length;
 803             unsafe.copyMemory(null, srcAddr, dst, offset, size);
 804             length -= size;
 805             srcAddr += size;
 806             offset += size;
 807         }
 808     }
 809 
 810     static void copyFromCharArray(Object src, long srcPos, long dstAddr,
 811                                   long length)
 812     {
 813         copyFromShortArray(src, srcPos, dstAddr, length);
 814     }
 815 
 816     static void copyToCharArray(long srcAddr, Object dst, long dstPos,
 817                                 long length)
 818     {
 819         copyToShortArray(srcAddr, dst, dstPos, length);
 820     }
 821 
 822     /**
 823      * Copy and byte swap 16-bit elements from a heap array to off-heap memory
 824      *
 825      * @param src
 826      *        the source array, must be a 16-bit primitive array type
 827      * @param srcPos
 828      *        byte offset within source array of the first element to read
 829      * @param dstAddr
 830      *        destination address
 831      * @param length
 832      *        number of bytes to copy
 833      */
 834     static native void copyFromShortArray(Object src, long srcPos, long dstAddr,
 835                                           long length);
 836 
 837     /**
 838      * Copy and byte swap 16-bit elements from off-heap memory to a heap array
 839      *
 840      * @param srcAddr
 841      *        source address
 842      * @param dst
 843      *        destination array, must be a 16-bit primitive array type
 844      * @param dstPos
 845      *        byte offset within the destination array of the first element to write
 846      * @param length
 847      *        number of bytes to copy
 848      */
 849     static native void copyToShortArray(long srcAddr, Object dst, long dstPos,
 850                                         long length);
 851 
 852     /**
 853      * Copy and byte swap 32-bit elements from a heap array to off-heap memory
 854      *
 855      * @param src
 856      *        the source array, must be a 32-bit primitive array type
 857      * @param srcPos
 858      *        byte offset within source array of the first element to read
 859      * @param dstAddr
 860      *        destination address
 861      * @param length
 862      *        number of bytes to copy
 863      */
 864     static native void copyFromIntArray(Object src, long srcPos, long dstAddr,
 865                                         long length);
 866 
 867     /**
 868      * Copy and byte swap 32-bit elements from off-heap memory to a heap array
 869      *
 870      * @param srcAddr
 871      *        source address
 872      * @param dst
 873      *        destination array, must be a 32-bit primitive array type
 874      * @param dstPos
 875      *        byte offset within the destination array of the first element to write
 876      * @param length
 877      *        number of bytes to copy
 878      */
 879     static native void copyToIntArray(long srcAddr, Object dst, long dstPos,
 880                                       long length);
 881 
 882     /**
 883      * Copy and byte swap 64-bit elements from a heap array to off-heap memory
 884      *
 885      * @param src
 886      *        the source array, must be a 64-bit primitive array type
 887      * @param srcPos
 888      *        byte offset within source array of the first element to read
 889      * @param dstAddr
 890      *        destination address
 891      * @param length
 892      *        number of bytes to copy
 893      */
 894     static native void copyFromLongArray(Object src, long srcPos, long dstAddr,
 895                                          long length);
 896 
 897     /**
 898      * Copy and byte swap 64-bit elements from off-heap memory to a heap array
 899      *
 900      * @param srcAddr
 901      *        source address
 902      * @param dst
 903      *        destination array, must be a 64-bit primitive array type
 904      * @param dstPos
 905      *        byte offset within the destination array of the first element to write
 906      * @param length
 907      *        number of bytes to copy
 908      */
 909     static native void copyToLongArray(long srcAddr, Object dst, long dstPos,
 910                                        long length);
 911 
 912 }
src/java.base/share/classes/java/nio/Bits.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File