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 $Type$Buffer position(int newPosition) { 1035 super.position(newPosition); 1036 return this; 1037 } 1038 1039 /** 1040 * {@inheritDoc} 1041 */ 1042 @Override 1043 public $Type$Buffer limit(int newLimit) { 1044 super.limit(newLimit); 1045 return this; 1046 } 1047 1048 /** 1049 * {@inheritDoc} 1050 */ 1051 @Override 1052 public $Type$Buffer mark() { 1053 super.mark(); 1054 return this; 1055 } 1056 1057 /** 1058 * {@inheritDoc} 1059 */ 1060 @Override 1061 public $Type$Buffer reset() { 1062 super.reset(); 1063 return this; 1064 } 1065 1066 /** 1067 * {@inheritDoc} 1068 */ 1069 @Override 1070 public $Type$Buffer clear() { 1071 super.clear(); 1072 return this; 1073 } 1074 1075 /** 1076 * {@inheritDoc} 1077 */ 1078 @Override 1079 public $Type$Buffer flip() { 1080 super.flip(); 1081 return this; 1082 } 1083 1084 /** 1085 * {@inheritDoc} 1086 */ 1087 @Override 1088 public $Type$Buffer rewind() { 1089 super.rewind(); 1090 return this; 1091 } 1092 1093 /** 1094 * Compacts this buffer <i>(optional operation)</i>. 1095 * 1096 * <p> The $type$s between the buffer's current position and its limit, 1097 * if any, are copied to the beginning of the buffer. That is, the 1098 * $type$ at index <i>p</i> = <tt>position()</tt> is copied 1099 * to index zero, the $type$ at index <i>p</i> + 1 is copied 1100 * to index one, and so forth until the $type$ at index 1101 * <tt>limit()</tt> - 1 is copied to index 1102 * <i>n</i> = <tt>limit()</tt> - <tt>1</tt> - <i>p</i>. 1103 * The buffer's position is then set to <i>n+1</i> and its limit is set to 1104 * its capacity. The mark, if defined, is discarded. 1105 * 1106 * <p> The buffer's position is set to the number of $type$s copied, 1107 * rather than to zero, so that an invocation of this method can be 1108 * followed immediately by an invocation of another relative <i>put</i> 1109 * method. </p> 1110 * 1111 #if[byte] 1112 * |