Home / File/ ByteBufOutputStream.java — netty Source File

ByteBufOutputStream.java — netty Source File

Architecture documentation for ByteBufOutputStream.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 io.netty.util.internal.ObjectUtil;

import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * An {@link OutputStream} which writes data to a {@link ByteBuf}.
 * <p>
 * A write operation against this stream will occur at the {@code writerIndex}
 * of its underlying buffer and the {@code writerIndex} will increase during
 * the write operation.
 * <p>
 * This stream implements {@link DataOutput} for your convenience.
 * The endianness of the stream is not always big endian but depends on
 * the endianness of the underlying buffer.
 *
 * @see ByteBufInputStream
 */
public class ByteBufOutputStream extends OutputStream implements DataOutput {

    private final ByteBuf buffer;
    private final int startIndex;
    private DataOutputStream utf8out; // lazily-instantiated
    private boolean closed;
    private final boolean releaseOnClose;

    /**
     * Creates a new stream which writes data to the specified {@code buffer}.
     */
    public ByteBufOutputStream(ByteBuf buffer) {
        this(buffer, false);
    }

    /**
     * Creates a new stream which writes data to the specified {@code buffer}.
     *
     * @param buffer Writes data to the buffer for this {@link OutputStream}.
     * @param releaseOnClose {@code true} means that when {@link #close()} is called then {@link ByteBuf#release()} will
     *                       be called on {@code buffer}.
     */
    public ByteBufOutputStream(ByteBuf buffer, boolean releaseOnClose) {
// ... (129 more lines)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free