本文整理汇总了Java中io.vertx.core.buffer.Buffer.appendByte方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.appendByte方法的具体用法?Java Buffer.appendByte怎么用?Java Buffer.appendByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.buffer.Buffer
的用法示例。
在下文中一共展示了Buffer.appendByte方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetInputStream
import io.vertx.core.buffer.Buffer; //导入方法依赖的package包/类
@Test
public void testGetInputStream() throws IOException {
Buffer body = Buffer.buffer();
body.appendByte((byte) 1);
new Expectations() {
{
context.getBody();
result = body;
}
};
ServletInputStream is = request.getInputStream();
Assert.assertSame(is, request.getInputStream());
int value = is.read();
is.close();
Assert.assertEquals(1, value);
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:TestVertxServerRequestToHttpServletRequest.java
示例2: testgetBytesFastBuffer
import io.vertx.core.buffer.Buffer; //导入方法依赖的package包/类
@Test
public void testgetBytesFastBuffer() {
Buffer buffer = Buffer.buffer();
buffer.appendByte((byte) 1);
byte[] result = VertxUtils.getBytesFast(buffer);
Assert.assertEquals(1, result[0]);
}
示例3: flushBuffer
import io.vertx.core.buffer.Buffer; //导入方法依赖的package包/类
@Test
public void flushBuffer() throws IOException {
Buffer buffer = Buffer.buffer();
ServletOutputStream output = new ServletOutputStream() {
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
@Override
public void write(int b) throws IOException {
buffer.appendByte((byte) b);
}
};
response = new MockUp<HttpServletResponse>() {
@Mock
ServletOutputStream getOutputStream() {
return output;
}
}.getMockInstance();
responseEx = new StandardHttpServletResponseEx(response);
// no body
responseEx.flushBuffer();
Assert.assertEquals(0, buffer.length());
Buffer body = Buffer.buffer().appendString("body");
responseEx.setBodyBuffer(body);
responseEx.flushBuffer();
Assert.assertEquals("body", buffer.toString());
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:38,代码来源:TestStandardHttpServletResponseEx.java
示例4: binaryCommand
import io.vertx.core.buffer.Buffer; //导入方法依赖的package包/类
private Buffer binaryCommand(Buffer buffer, String key, Object[] params)
{
append(buffer, key);
if (params != null) {
for (Object str : params) {
append(buffer, str.toString());
}
}
buffer.appendByte(CTRL_N);
return buffer;
}