1008 * method in order to ensure that this buffer has an accessible backing 1009 * array. </p> 1010 * 1011 * @return The offset within this buffer's array 1012 * of the first element of the buffer 1013 * 1014 * @throws ReadOnlyBufferException 1015 * If this buffer is backed by an array but is read-only 1016 * 1017 * @throws UnsupportedOperationException 1018 * If this buffer is not backed by an accessible array 1019 */ 1020 public final int arrayOffset() { 1021 if (hb == null) 1022 throw new UnsupportedOperationException(); 1023 if (isReadOnly) 1024 throw new ReadOnlyBufferException(); 1025 return offset; 1026 } 1027 1028 /** 1029 * Compacts this buffer <i>(optional operation)</i>. 1030 * 1031 * <p> The $type$s between the buffer's current position and its limit, 1032 * if any, are copied to the beginning of the buffer. That is, the 1033 * $type$ at index <i>p</i> = <tt>position()</tt> is copied 1034 * to index zero, the $type$ at index <i>p</i> + 1 is copied 1035 * to index one, and so forth until the $type$ at index 1036 * <tt>limit()</tt> - 1 is copied to index 1037 * <i>n</i> = <tt>limit()</tt> - <tt>1</tt> - <i>p</i>. 1038 * The buffer's position is then set to <i>n+1</i> and its limit is set to 1039 * its capacity. The mark, if defined, is discarded. 1040 * 1041 * <p> The buffer's position is set to the number of $type$s copied, 1042 * rather than to zero, so that an invocation of this method can be 1043 * followed immediately by an invocation of another relative <i>put</i> 1044 * method. </p> 1045 * 1046 #if[byte] 1047 * | 1008 * method in order to ensure that this buffer has an accessible backing 1009 * array. </p> 1010 * 1011 * @return The offset within this buffer's array 1012 * of the first element of the buffer 1013 * 1014 * @throws ReadOnlyBufferException 1015 * If this buffer is backed by an array but is read-only 1016 * 1017 * @throws UnsupportedOperationException 1018 * If this buffer is not backed by an accessible array 1019 */ 1020 public final int arrayOffset() { 1021 if (hb == null) 1022 throw new UnsupportedOperationException(); 1023 if (isReadOnly) 1024 throw new ReadOnlyBufferException(); 1025 return offset; 1026 } 1027 1028 // -- Covariant return type overrides 1029 1030 /** 1031 * {@inheritDoc} 1032 */ 1033 @Override 1034 public 1035 #if[!byte] 1036 final 1037 #end[!byte] 1038 $Type$Buffer position(int newPosition) { 1039 super.position(newPosition); 1040 return this; 1041 } 1042 1043 /** 1044 * {@inheritDoc} 1045 */ 1046 @Override 1047 public 1048 #if[!byte] 1049 final 1050 #end[!byte] 1051 $Type$Buffer limit(int newLimit) { 1052 super.limit(newLimit); 1053 return this; 1054 } 1055 1056 /** 1057 * {@inheritDoc} 1058 */ 1059 @Override 1060 public 1061 #if[!byte] 1062 final 1063 #end[!byte] 1064 $Type$Buffer mark() { 1065 super.mark(); 1066 return this; 1067 } 1068 1069 /** 1070 * {@inheritDoc} 1071 */ 1072 @Override 1073 public 1074 #if[!byte] 1075 final 1076 #end[!byte] 1077 $Type$Buffer reset() { 1078 super.reset(); 1079 return this; 1080 } 1081 1082 /** 1083 * {@inheritDoc} 1084 */ 1085 @Override 1086 public 1087 #if[!byte] 1088 final 1089 #end[!byte] 1090 $Type$Buffer clear() { 1091 super.clear(); 1092 return this; 1093 } 1094 1095 /** 1096 * {@inheritDoc} 1097 */ 1098 @Override 1099 public 1100 #if[!byte] 1101 final 1102 #end[!byte] 1103 $Type$Buffer flip() { 1104 super.flip(); 1105 return this; 1106 } 1107 1108 /** 1109 * {@inheritDoc} 1110 */ 1111 @Override 1112 public 1113 #if[!byte] 1114 final 1115 #end[!byte] 1116 $Type$Buffer rewind() { 1117 super.rewind(); 1118 return this; 1119 } 1120 1121 /** 1122 * Compacts this buffer <i>(optional operation)</i>. 1123 * 1124 * <p> The $type$s between the buffer's current position and its limit, 1125 * if any, are copied to the beginning of the buffer. That is, the 1126 * $type$ at index <i>p</i> = <tt>position()</tt> is copied 1127 * to index zero, the $type$ at index <i>p</i> + 1 is copied 1128 * to index one, and so forth until the $type$ at index 1129 * <tt>limit()</tt> - 1 is copied to index 1130 * <i>n</i> = <tt>limit()</tt> - <tt>1</tt> - <i>p</i>. 1131 * The buffer's position is then set to <i>n+1</i> and its limit is set to 1132 * its capacity. The mark, if defined, is discarded. 1133 * 1134 * <p> The buffer's position is set to the number of $type$s copied, 1135 * rather than to zero, so that an invocation of this method can be 1136 * followed immediately by an invocation of another relative <i>put</i> 1137 * method. </p> 1138 * 1139 #if[byte] 1140 * |