Java Code Examples for org.redisson.api.RBinaryStream#get()

The following examples show how to use org.redisson.api.RBinaryStream#get() . 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: RedissonBinaryStreamTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Test
public void testWriteArrayWithOffset() throws IOException {
    RBinaryStream stream = redisson.getBinaryStream("test");
    OutputStream os = stream.getOutputStream();

    byte[] value = {1, 2, 3, 4, 5, 6};
    os.write(value, 0, 3);
    byte[] s = stream.get();
    
    assertThat(s).isEqualTo(new byte[] {1, 2, 3});
    
    os.write(value, 3, 3);
    s = stream.get();
    
    assertThat(s).isEqualTo(value);
}
 
Example 2
Source File: RedissonBinaryStreamTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteArray() throws IOException {
    RBinaryStream stream = redisson.getBinaryStream("test");
    OutputStream os = stream.getOutputStream();
    byte[] value = {1, 2, 3, 4, 5, 6};
    os.write(value);
    
    byte[] s = stream.get();
    assertThat(s).isEqualTo(value);
}