Java Code Examples for io.vertx.reactivex.core.buffer.Buffer#buffer()

The following examples show how to use io.vertx.reactivex.core.buffer.Buffer#buffer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxWebTestBase.java    From graviteeio-access-management with Apache License 2.0 5 votes vote down vote up
protected static Buffer normalizeLineEndingsFor(Buffer buff) {
    int buffLen = buff.length();
    Buffer normalized = Buffer.buffer(buffLen);
    for (int i = 0; i < buffLen; i++) {
        short unsignedByte = buff.getUnsignedByte(i);
        if (unsignedByte != '\r' || i + 1 == buffLen || buff.getUnsignedByte(i + 1) != '\n') {
            normalized.appendUnsignedByte(unsignedByte);
        }
    }
    return normalized;
}
 
Example 2
Source File: EqualityTest.java    From vertx-rx with Apache License 2.0 5 votes vote down vote up
@Test
public void testBufferEquality() {
  Buffer buf1 = Buffer.buffer("The quick brown fox jumps over the lazy dog");
  Buffer buf2 = buf1.copy();
  assertNotSame(buf1, buf2);
  assertEquals(buf1, buf2);
}
 
Example 3
Source File: GameServerVerticle.java    From ocraft-s2client with MIT License 4 votes vote down vote up
private void sendResponse(ServerWebSocket serverWebSocket, Sc2Api.Response response) {
    log.debug("Sending response {}", response);
    Buffer buffer = Buffer.buffer();
    buffer.getDelegate().appendBytes(response.toByteArray());
    serverWebSocket.write(buffer);
}
 
Example 4
Source File: EqualityTest.java    From vertx-rx with Apache License 2.0 4 votes vote down vote up
@Test
public void testBufferSet() {
  Buffer buf1 = Buffer.buffer("The quick brown fox jumps over the lazy dog");
  Buffer buf2 = buf1.copy();
  assertEquals(1, Stream.of(buf1, buf2).collect(toSet()).size());
}