依次使用readInt(),readBytes(byte[],int,int)
其中readBytes是读指定长度字节到数组,然后由数组建立字符串。new String(byte[])

解决方案 »

  1.   

    String a=new String(byte[] bytes);
      

  2.   


    //分解int
    int readInt(byte [] buf, int beginPos)
    {
       result |= buf[beginPos]&0xff;
       result <<= 8;
       result |= buf[beginPos + 1]&0xff;
       result <<= 8;
       result |= buf[beginPos + 2]&0xff;
       result <<= 8;
       result |= buf[beginPos + 3]&0xff;
       return result;
    }//分解String
    String readString(byte []buf, int beginPos, int endPos)
    {
       return new String(buf, beginPos, endPos);
    }