Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

java 代码 字符串处理 疑惑求解

 public static final void addField(String str, boolean z, String str2, boolean z2) throws IOException {
        if (str == null) {
            throw new NullPointerException("name");
        } else if (str2 != null) {
            if (content.size() > 0) {
                content.write(38);
            }
            String str3 = "UTF-8";
            if (z) {
                try {
                    str = URLEncoder.encode(str, str3);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (z2) {
                str2 = URLEncoder.encode(str2, str3);
            }
            content.write(str.getBytes(str3));
            content.write(61);
            content.write(str2.getBytes(str3));
        } else {
            throw new NullPointerException("value");
        }
    }

这个代码里面的 content.write(61); 我打印了结果 和我穿进去的字符串结果是一样的,请问这里的61有什么用呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

代码是反编译的吧? ascii 38 是 &字符,61是 =,这就是在拼URL参数而已。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...