< prev index next >
src/java.base/share/classes/java/lang/StringConcatHelper.java
Print this page
rev 54588 : imported patch constant_prepend
*** 278,287 ****
--- 278,394 ----
value.getBytes(buf, (int)indexCoder, String.UTF16);
}
return indexCoder;
}
+
+ /**
+ * Prepends the stringly representation of boolean value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value boolean value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, boolean value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of byte value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value byte value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, byte value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of char value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value char value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, char value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of short value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value short value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, short value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of integer value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value integer value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, int value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of long value into buffer,
+ * given the coder and final index. Index is measured in chars, not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value long value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, long value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
+ /**
+ * Prepends the stringly representation of a constant String and a String value
+ * into buffer, given the coder and final index. Index is measured in chars,
+ * not in bytes!
+ *
+ * @param indexCoder final char index in the buffer, along with coder packed
+ * into higher bits.
+ * @param buf buffer to append to
+ * @param value String value to encode
+ * @return updated index (coder value retained)
+ */
+ static long prepend(long indexCoder, byte[] buf, String constant, String value) {
+ indexCoder = prepend(indexCoder, buf, value);
+ return prepend(indexCoder, buf, constant);
+ }
+
/**
* Instantiates the String with given buffer and coder
* @param buf buffer to use
* @param indexCoder remaining index (should be zero) and coder
* @return String resulting string
< prev index next >