Document DataBuffer/PooledDataBuffer and codecs
Issue: SPR-16156
This commit is contained in:
@@ -40,9 +40,9 @@ import java.util.function.IntPredicate;
|
||||
* <p>The {@linkplain #capacity() capacity} of a {@code DataBuffer} is expanded on demand,
|
||||
* similar to {@code StringBuilder}.
|
||||
*
|
||||
* <p>The main purpose of the {@code DataBuffer} abstraction is provide a convenient wrapper around
|
||||
* {@link ByteBuffer}, similar to Netty's {@link io.netty.buffer.ByteBuf}, that can also be used on
|
||||
* non-Netty platforms (i.e. Servlet).
|
||||
* <p>The main purpose of the {@code DataBuffer} abstraction is to provide a convenient wrapper
|
||||
* around {@link ByteBuffer} that is similar to Netty's {@link io.netty.buffer.ByteBuf}, but that
|
||||
* can also be used on non-Netty platforms (i.e. Servlet).
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
@@ -237,14 +237,14 @@ public interface DataBuffer {
|
||||
ByteBuffer asByteBuffer(int index, int length);
|
||||
|
||||
/**
|
||||
* Expose this buffer's data as an {@link InputStream}. Both data and position are
|
||||
* Expose this buffer's data as an {@link InputStream}. Both data and read position are
|
||||
* shared between the returned stream and this data buffer.
|
||||
* @return this data buffer as an input stream
|
||||
*/
|
||||
InputStream asInputStream();
|
||||
|
||||
/**
|
||||
* Expose this buffer's data as an {@link OutputStream}. Both data and position are
|
||||
* Expose this buffer's data as an {@link OutputStream}. Both data and write position are
|
||||
* shared between the returned stream and this data buffer.
|
||||
* @return this data buffer as an output stream
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,7 @@ package org.springframework.core.io.buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* A factory for {@link DataBuffer}s,allowing for allocation and wrapping of
|
||||
* A factory for {@link DataBuffer}s, allowing for allocation and wrapping of
|
||||
* data buffers.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -46,14 +46,16 @@ public interface DataBufferFactory {
|
||||
DataBuffer allocateBuffer(int initialCapacity);
|
||||
|
||||
/**
|
||||
* Wrap the given {@link ByteBuffer} in a {@code DataBuffer}.
|
||||
* Wrap the given {@link ByteBuffer} in a {@code DataBuffer}. Unlike
|
||||
* {@linkplain #allocateBuffer(int) allocating}, wrapping does not use new memory.
|
||||
* @param byteBuffer the NIO byte buffer to wrap
|
||||
* @return the wrapped buffer
|
||||
*/
|
||||
DataBuffer wrap(ByteBuffer byteBuffer);
|
||||
|
||||
/**
|
||||
* Wrap the given {@code byte} array in a {@code DataBuffer}.
|
||||
* Wrap the given {@code byte} array in a {@code DataBuffer}. Unlike
|
||||
* {@linkplain #allocateBuffer(int) allocating}, wrapping does not use new memory.
|
||||
* @param bytes the byte array to wrap
|
||||
* @return the wrapped buffer
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user