本文整理了Java中okio.Buffer.readUtf8Line()
方法的一些代码示例,展示了Buffer.readUtf8Line()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.readUtf8Line()
方法的具体详情如下:
包路径:okio.Buffer
类名称:Buffer
方法名:readUtf8Line
暂无
代码示例来源:origin: spring-projects/spring-framework
private void assertPart(Buffer buffer, String disposition, String boundary, String name,
String contentType, String value) throws EOFException {
assertTrue(buffer.readUtf8Line().contains("--" + boundary));
String line = buffer.readUtf8Line();
assertTrue(line.contains("Content-Disposition: "+ disposition));
assertTrue(line.contains("name=\""+ name + "\""));
assertTrue(buffer.readUtf8Line().startsWith("Content-Type: "+contentType));
assertTrue(buffer.readUtf8Line().equals("Content-Length: " + value.length()));
assertTrue(buffer.readUtf8Line().equals(""));
assertTrue(buffer.readUtf8Line().equals(value));
}
代码示例来源:origin: spring-projects/spring-framework
private void assertFilePart(Buffer buffer, String disposition, String boundary, String name,
String filename, String contentType) throws EOFException {
assertTrue(buffer.readUtf8Line().contains("--" + boundary));
String line = buffer.readUtf8Line();
assertTrue(line.contains("Content-Disposition: "+ disposition));
assertTrue(line.contains("name=\""+ name + "\""));
assertTrue(line.contains("filename=\""+ filename + "\""));
assertTrue(buffer.readUtf8Line().startsWith("Content-Type: "+contentType));
assertTrue(buffer.readUtf8Line().startsWith("Content-Length: "));
assertTrue(buffer.readUtf8Line().equals(""));
assertNotNull(buffer.readUtf8Line());
}
代码示例来源:origin: rengwuxian/HenCoderPlus
private static void okio1() {
try (Source source = Okio.buffer(Okio.source(new File("./19_io/text.txt")))) {
Buffer buffer = new Buffer();
source.read(buffer, 1024);
System.out.println(buffer.readUtf8Line());
System.out.println(buffer.readUtf8Line());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: huxq17/tractor
@Override public String readUtf8Line() throws IOException {
long newline = indexOf((byte) '\n');
if (newline == -1) {
return buffer.size != 0 ? readUtf8(buffer.size) : null;
}
return buffer.readUtf8Line(newline);
}
代码示例来源:origin: huxq17/tractor
@Override public String readUtf8Line() throws EOFException {
long newline = indexOf((byte) '\n');
if (newline == -1) {
return size != 0 ? readUtf8(size) : null;
}
return readUtf8Line(newline);
}
代码示例来源:origin: huxq17/tractor
@Override public String readUtf8LineStrict() throws EOFException {
long newline = indexOf((byte) '\n');
if (newline == -1) {
Buffer data = new Buffer();
copyTo(data, 0, Math.min(32, size));
throw new EOFException("\\n not found: size=" + size()
+ " content=" + data.readByteString().hex() + "...");
}
return readUtf8Line(newline);
}
代码示例来源:origin: huxq17/tractor
@Override public String readUtf8LineStrict() throws IOException {
long newline = indexOf((byte) '\n');
if (newline == -1L) {
Buffer data = new Buffer();
buffer.copyTo(data, 0, Math.min(32, buffer.size()));
throw new EOFException("\\n not found: size=" + buffer.size()
+ " content=" + data.readByteString().hex() + "...");
}
return buffer.readUtf8Line(newline);
}
内容来源于网络,如有侵权,请联系作者删除!