Home / File/ ByteBufStreamTest.java — netty Source File

ByteBufStreamTest.java — netty Source File

Architecture documentation for ByteBufStreamTest.java, a java file in the netty codebase.

File java Buffer Search 1 classes

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.buffer;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;

import java.io.EOFException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import static io.netty.util.internal.EmptyArrays.EMPTY_BYTES;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
 * Tests channel buffer streams
 */
public class ByteBufStreamTest {

    @Test
    public void testAll() throws Exception {
        ByteBuf buf = Unpooled.buffer(0, 65536);

        try {
            new ByteBufOutputStream(null);
            fail();
        } catch (NullPointerException e) {
            // Expected
        }

        assertThrows(IndexOutOfBoundsException.class, () -> new ByteBufOutputStream(buf).write(EMPTY_BYTES, -1, 0));

        try (ByteBufOutputStream out = new ByteBufOutputStream(buf)) {
            assertSame(buf, out.buffer());
            out.writeBoolean(true);
            out.writeBoolean(false);
            out.writeByte(42);
            out.writeByte(224);
            out.writeBytes("Hello, World!");
// ... (297 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ByteBufStreamTest.java do?
ByteBufStreamTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Search subdomain.
Where is ByteBufStreamTest.java in the architecture?
ByteBufStreamTest.java is located at buffer/src/test/java/io/netty/buffer/ByteBufStreamTest.java (domain: Buffer, subdomain: Search, directory: buffer/src/test/java/io/netty/buffer).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free