okio.ByteString.toAsciiUppercase()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中okio.ByteString.toAsciiUppercase()方法的一些代码示例,展示了ByteString.toAsciiUppercase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.toAsciiUppercase()方法的具体详情如下:
包路径:okio.ByteString
类名称:ByteString
方法名:toAsciiUppercase

ByteString.toAsciiUppercase介绍

[英]Returns a byte string equal to this byte string, but with the bytes 'a' through 'z' replaced with the corresponding byte in 'A' through 'Z'. Returns this byte string if it contains no bytes in 'a' through 'z'.
[中]返回一个等于此字节字符串的字节字符串,但字节“a”到“z”替换为“a”到“z”中的相应字节。如果“a”到“z”中不包含字节,则返回此字节字符串。

代码示例

代码示例来源:origin: square/okio

@Test public void readAndToUppercase() throws Exception {
 InputStream in = new ByteArrayInputStream("abc".getBytes(Charsets.UTF_8));
 assertEquals(ByteString.encodeUtf8("AB"), ByteString.read(in, 2).toAsciiUppercase());
 assertEquals(ByteString.encodeUtf8("C"), ByteString.read(in, 1).toAsciiUppercase());
 assertEquals(ByteString.EMPTY, ByteString.read(in, 0).toAsciiUppercase());
}

代码示例来源:origin: square/okio

@Test public void toAsciiStartsUppercaseEndsLowercase() throws Exception {
 assertEquals(ByteString.encodeUtf8("ABCD"), factory.encodeUtf8("ABcd").toAsciiUppercase());
}

代码示例来源:origin: huxq17/tractor

@Override public ByteString toAsciiUppercase() {
 return toByteString().toAsciiUppercase();
}

代码示例来源:origin: Tickaroo/tikxml

/**
 * Checks for DOCTYPE beginning {@code <!DOCTYPE }. This method doesn't consume the opening <!DOCTYPE
 * Tag
 *
 * @return true, if DOCTYPE opening tag, otherwise false
 * @throws IOException
 */
private boolean isDocTypeDefinition() throws IOException {
 return buffer.size() >= DOCTYPE_OPEN.size() &&
     buffer.snapshot(DOCTYPE_OPEN.size()).toAsciiUppercase().equals(DOCTYPE_OPEN);
}

相关文章