本文整理匯總了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;
}