List of utility methods to do Convert via ByteBuffer
short[] | toShortArray(byte[] arr) Convert byte array to short array short[] shortBlocks = new short[arr.length / 2]; ByteBuffer.wrap(arr).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shortBlocks); return shortBlocks; |
short[] | toShortArray(final byte[] byteArray) to Short Array short[] shortArray = new short[byteArray.length]; for (int i = 0; i < byteArray.length; i++) { shortArray[i] = toShort(byteArray[i]); return shortArray; |
List | toSimpleList(List Converts a list of low-level AttributeValue into a list of simple values.
if (attrValues == null) return null; List<Object> result = new ArrayList<Object>(attrValues.size()); for (AttributeValue attrValue : attrValues) { Object value = toSimpleValue(attrValue); result.add(value); return result; ... |
void | toString(byte[] buf, int arrayOffset, int origLimit, StringBuilder sb) to String int limit = (origLimit - arrayOffset > 128) ? arrayOffset + 128 : origLimit; for (int i = arrayOffset; i < limit; i++) { if (i > arrayOffset) { sb.append(" "); sb.append(paddedByteString(buf[i])); if (origLimit != limit) { ... |
String | toString(byte[] value, int offset, int length, String encoding) to String Charset cs = findCharset(encoding);
return cs.decode(ByteBuffer.wrap(value, offset, length)).toString();
|
String | toString(final String filename) Converts the contents of a file to a String return toString(new File(filename)); |
String | toString(final Xid xid) to String final StringBuilder buf = new StringBuilder(512).append("[").append(Integer.toHexString(xid.getFormatId())) .append("]-["); ByteBuffer byteBuffer = ByteBuffer.wrap(xid.getGlobalTransactionId()); for (int i = 0; i < Xid.MAXGTRIDSIZE / 8; ++i) { buf.append(Long.toHexString(byteBuffer.getLong())).append(":"); buf.setLength(buf.length() - 1); buf.append("]-["); ... |
String | toString(InputStream is) to String StringBuilder result = new StringBuilder(); InputStreamReader in = new InputStreamReader(is); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); buffer.flush(); return new String(buffer.toByteArray(), Charset.forName("UTF-8")); |
String | toString(Object o) to String return toString(o, -1);
|
String | toString(Reader r) Returns a String representation of the given Reader. Writer sw = new StringWriter(); copyAndClose(r, sw); return sw.toString(); |