Android Byte Array to String Convert toStringUntil(byte[] b, int pos, byte until)

Here you can find the source of toStringUntil(byte[] b, int pos, byte until)

Description

to String Until

Declaration

public static String toStringUntil(byte[] b, int pos, byte until) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toStringUntil(byte[] b, int pos, byte until) {
        StringBuilder str = new StringBuilder();

        while (true) {
            if (b.length <= pos) {
                return null;
            }/*from  w w w  .  j  a va  2  s.c om*/

            byte ch = b[pos];

            if (ch == until) {
                break;
            }
            str.append((char) ch);
            pos++;
        }

        String ret = str.toString();
        return ret;
    }
}

Related

  1. byteToString(byte[] in)
  2. byteToString(int[] byteData)
  3. base16(byte[] data)
  4. ByteArrayToStringList(byte[] byteArray, int dataLength)
  5. toStringForm(byte[] arr)
  6. toStringWithLength(byte[] b, int pos, int length)
  7. printBytes(byte[] bytes, StringBuilder builder, int bytesPerLine)
  8. printBytes(byte[] bytes, int bytesPerLine)
  9. printBytes(byte[] data, String type)