Top Description Fields Constructors Methods
org.springframework.core.io.buffer

public Class DataBufferWrapper

extends Object
implements DataBuffer
Class Inheritance
All Implemented Interfaces
org.springframework.core.io.buffer.DataBuffer
Imports
java.io.InputStream, .OutputStream, java.nio.ByteBuffer, java.nio.charset.Charset, java.util.function.IntPredicate, org.springframework.util.Assert

Provides a convenient implementation of the DataBuffer interface that can be overridden to adapt the delegate.

These methods default to calling through to the wrapped delegate object.

Author
Arjen Poutsma
Since
5.2

Field Summary

Modifier and TypeField and Description
private final DataBuffer

Constructor Summary

AccessConstructor and Description
public
DataBufferWrapper(DataBuffer
the buffer to wrap
delegate
)

Create a new DataBufferWrapper that wraps the given buffer.

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
asByteBuffer()

Implements org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Deprecated

Expose this buffer's bytes as a ByteBuffer.

public ByteBuffer
asByteBuffer(int
the index at which to start the byte buffer
index
,
int
the length of the returned byte buffer
length
)

Implements org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Deprecated

Expose a subsequence of this buffer's bytes as a ByteBuffer.

public InputStream
asInputStream()

Overrides default org.springframework.core.io.buffer.DataBuffer.asInputStream.

Expose this buffer's data as an InputStream.

public InputStream
asInputStream(boolean
whether the underlying buffer will be released when the input stream is closed.
releaseOnClose
)

Overrides default org.springframework.core.io.buffer.DataBuffer.asInputStream.

Expose this buffer's data as an InputStream.

public OutputStream
public int
capacity()

Implements org.springframework.core.io.buffer.DataBuffer.capacity.

Return the number of bytes that this buffer can contain.

public DataBuffer
capacity(int
the new capacity
capacity
)

Implements org.springframework.core.io.buffer.DataBuffer.capacity.

Deprecated

Set the number of bytes that this buffer can contain.

public DataBuffer
dataBuffer()

Return the wrapped delegate.

public DataBuffer
ensureCapacity(int
the writable capacity to check for
capacity
)

Overrides default org.springframework.core.io.buffer.DataBuffer.ensureCapacity.

Deprecated

Ensure that the current buffer has enough writableByteCount() to write the amount of data given as an argument.

public DataBuffer
ensureWritable(int
the writable capacity to check for
capacity
)

Implements org.springframework.core.io.buffer.DataBuffer.ensureWritable.

Ensure that the current buffer has enough writableByteCount() to write the amount of data given as an argument.

public DataBufferFactory
factory()

Implements org.springframework.core.io.buffer.DataBuffer.factory.

Return the DataBufferFactory that created this buffer.

public byte
getByte(int
the index at which the byte will be read
index
)

Implements org.springframework.core.io.buffer.DataBuffer.getByte.

Read a single byte at the given index from this data buffer.

public int
indexOf(IntPredicate
the predicate to match
predicate
,
int
the index to start the search from
fromIndex
)

Implements org.springframework.core.io.buffer.DataBuffer.indexOf.

Return the index of the first byte in this buffer that matches the given predicate.

public int
lastIndexOf(IntPredicate
the predicate to match
predicate
,
int
the index to start the search from
fromIndex
)

Implements org.springframework.core.io.buffer.DataBuffer.lastIndexOf.

Return the index of the last byte in this buffer that matches the given predicate.

public byte
read()

Implements org.springframework.core.io.buffer.DataBuffer.read.

Read a single byte from the current reading position from this data buffer.

public DataBuffer
read(byte[]
the array into which the bytes are to be written
destination
)

Implements org.springframework.core.io.buffer.DataBuffer.read.

Read this buffer's data into the specified destination, starting at the current reading position of this buffer.

public DataBuffer
read(byte[]
the array into which the bytes are to be written
destination
,
int
the index within destination of the first byte to be written
offset
,
int
the maximum number of bytes to be written in destination
length
)

Implements org.springframework.core.io.buffer.DataBuffer.read.

Read at most length bytes of this buffer into the specified destination, starting at the current reading position of this buffer.

public DataBuffer.ByteBufferIterator
readableByteBuffers()

Implements org.springframework.core.io.buffer.DataBuffer.readableByteBuffers.

Returns a closeable iterator over each ByteBuffer in this data buffer that can be read.

public int
readableByteCount()

Implements org.springframework.core.io.buffer.DataBuffer.readableByteCount.

Return the number of bytes that can be read from this data buffer.

public int
readPosition()

Implements org.springframework.core.io.buffer.DataBuffer.readPosition.

Return the position from which this buffer will read.

public DataBuffer
readPosition(int
the new read position
readPosition
)

Implements org.springframework.core.io.buffer.DataBuffer.readPosition.

Set the position from which this buffer will read.

public DataBuffer
retainedSlice(int
the index at which to start the slice
index
,
int
the length of the slice
length
)

Overrides default org.springframework.core.io.buffer.DataBuffer.retainedSlice.

Deprecated

Create a new DataBuffer whose contents is a shared, retained subsequence of this data buffer's content.

public DataBuffer
slice(int
the index at which to start the slice
index
,
int
the length of the slice
length
)

Implements org.springframework.core.io.buffer.DataBuffer.slice.

Deprecated

Create a new DataBuffer whose contents is a shared subsequence of this data buffer's content.

public DataBuffer
split(int
the index at which it should be split
index
)

Implements org.springframework.core.io.buffer.DataBuffer.split.

Splits this data buffer into two at the given index.

public ByteBuffer
toByteBuffer()

Overrides default org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Deprecated

Returns a ByteBuffer representation of this data buffer.

public ByteBuffer
toByteBuffer(int index, int length)

Implements org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Deprecated

Returns a ByteBuffer representation of a subsequence of this buffer's bytes.

public void
toByteBuffer(ByteBuffer
the destination byte buffer
dest
)

Overrides default org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Copies this entire data buffer into the given destination ByteBuffer, beginning at the current reading position, and the current position of destination byte buffer.

public void
toByteBuffer(int
the position of this data buffer from where copying should start
srcPos
,
ByteBuffer
the destination byte buffer
dest
,
int
the position in dest to where copying should start
destPos
,
int
the amount of data to copy
length
)

Implements org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Copies the given length from this data buffer into the given destination ByteBuffer, beginning at the given source position, and the given destination position in the destination byte buffer.

public String
toString(Charset
the character set to use
charset
)

Overrides default org.springframework.core.io.buffer.DataBuffer.toString.

Return this buffer's data a String using the specified charset.

public String
toString(int
the index at which to start the string
index
,
int
the number of bytes to use for the string
length
,
Charset
the charset to use
charset
)

Implements org.springframework.core.io.buffer.DataBuffer.toString.

Return a part of this buffer's data as a String using the specified charset.

public DataBuffer.ByteBufferIterator
writableByteBuffers()

Implements org.springframework.core.io.buffer.DataBuffer.writableByteBuffers.

Returns a closeable iterator over each ByteBuffer in this data buffer that can be written to.

public int
writableByteCount()

Implements org.springframework.core.io.buffer.DataBuffer.writableByteCount.

Return the number of bytes that can be written to this data buffer.

public DataBuffer
write(byte
the byte to be written
b
)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Write a single byte into this buffer at the current writing position.

public DataBuffer
write(byte[]
the bytes to be written into this buffer
source
)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Write the given source into this buffer, starting at the current writing position of this buffer.

public DataBuffer
write(byte[]
the bytes to be written into this buffer
source
,
int
the index within source to start writing from
offset
,
int
the maximum number of bytes to be written from source
length
)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Write at most length bytes of the given source into this buffer, starting at the current writing position of this buffer.

public DataBuffer
write(DataBuffer...
the byte buffers to write into this buffer
buffers
)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Write one or more DataBuffers to this buffer, starting at the current writing position.

public DataBuffer
write(ByteBuffer...
the byte buffers to write into this buffer
buffers
)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Write one or more ByteBuffer to this buffer, starting at the current writing position.

public DataBuffer
write(CharSequence
the char sequence to write into this buffer
charSequence
,
Charset
the charset to encode the char sequence with
charset
)

Overrides default org.springframework.core.io.buffer.DataBuffer.write.

Write the given CharSequence using the given Charset, starting at the current writing position.

public int
writePosition()

Implements org.springframework.core.io.buffer.DataBuffer.writePosition.

Return the position to which this buffer will write.

public DataBuffer
writePosition(int
the new write position
writePosition
)

Implements org.springframework.core.io.buffer.DataBuffer.writePosition.

Set the position to which this buffer will write.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final DataBuffer delegate

Constructor Detail

DataBufferWrapperback to summary
public DataBufferWrapper(DataBuffer delegate)

Create a new DataBufferWrapper that wraps the given buffer.

Parameters
delegate:DataBuffer

the buffer to wrap

Method Detail

asByteBufferback to summary
public ByteBuffer asByteBuffer()

Implements org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Deprecated

Expose this buffer's bytes as a ByteBuffer. Data between this DataBuffer and the returned ByteBuffer is shared; though changes in the returned buffer's position will not be reflected in the reading nor writing position of this data buffer.

Returns:ByteBuffer

this data buffer as a byte buffer

Annotations
@Override
@Deprecated
asByteBufferback to summary
public ByteBuffer asByteBuffer(int index, int length)

Implements org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.asByteBuffer.

Deprecated

Expose a subsequence of this buffer's bytes as a ByteBuffer. Data between this DataBuffer and the returned ByteBuffer is shared; though changes in the returned buffer's position will not be reflected in the reading nor writing position of this data buffer.

Parameters
index:int

the index at which to start the byte buffer

length:int

the length of the returned byte buffer

Returns:ByteBuffer

this data buffer as a byte buffer

Annotations
@Override
@Deprecated
asInputStreamback to summary
public InputStream asInputStream()

Overrides default org.springframework.core.io.buffer.DataBuffer.asInputStream.

Doc from org.springframework.core.io.buffer.DataBuffer.asInputStream.

Expose this buffer's data as an InputStream. Both data and read position are shared between the returned stream and this data buffer. The underlying buffer will not be released when the input stream is closed.

Returns:InputStream

this data buffer as an input stream

Annotations
@Override
asInputStreamback to summary
public InputStream asInputStream(boolean releaseOnClose)

Overrides default org.springframework.core.io.buffer.DataBuffer.asInputStream.

Doc from org.springframework.core.io.buffer.DataBuffer.asInputStream.

Expose this buffer's data as an InputStream. Both data and read position are shared between the returned stream and this data buffer.

Parameters
releaseOnClose:boolean

whether the underlying buffer will be released when the input stream is closed.

Returns:InputStream

this data buffer as an input stream

Annotations
@Override
asOutputStreamback to summary
public OutputStream asOutputStream()

Overrides default org.springframework.core.io.buffer.DataBuffer.asOutputStream.

Doc from org.springframework.core.io.buffer.DataBuffer.asOutputStream.

Expose this buffer's data as an OutputStream. Both data and write position are shared between the returned stream and this data buffer.

Returns:OutputStream

this data buffer as an output stream

Annotations
@Override
capacityback to summary
public int capacity()

Implements org.springframework.core.io.buffer.DataBuffer.capacity.

Doc from org.springframework.core.io.buffer.DataBuffer.capacity.

Return the number of bytes that this buffer can contain.

Returns:int

the capacity

Annotations
@Override
capacityback to summary
public DataBuffer capacity(int capacity)

Implements org.springframework.core.io.buffer.DataBuffer.capacity.

Doc from org.springframework.core.io.buffer.DataBuffer.capacity.

Deprecated

Set the number of bytes that this buffer can contain.

If the new capacity is lower than the current capacity, the contents of this buffer will be truncated. If the new capacity is higher than the current capacity, it will be expanded.

Parameters
capacity:int

the new capacity

Returns:DataBuffer

this buffer

Annotations
@Override
@Deprecated
dataBufferback to summary
public DataBuffer dataBuffer()

Return the wrapped delegate.

ensureCapacityback to summary
public DataBuffer ensureCapacity(int capacity)

Overrides default org.springframework.core.io.buffer.DataBuffer.ensureCapacity.

Doc from org.springframework.core.io.buffer.DataBuffer.ensureCapacity.

Deprecated

Ensure that the current buffer has enough writableByteCount() to write the amount of data given as an argument. If not, the missing capacity will be added to the buffer.

Parameters
capacity:int

the writable capacity to check for

Returns:DataBuffer

this buffer

Annotations
@Override
@Deprecated
ensureWritableback to summary
public DataBuffer ensureWritable(int capacity)

Implements org.springframework.core.io.buffer.DataBuffer.ensureWritable.

Doc from org.springframework.core.io.buffer.DataBuffer.ensureWritable.

Ensure that the current buffer has enough writableByteCount() to write the amount of data given as an argument. If not, the missing capacity will be added to the buffer.

Parameters
capacity:int

the writable capacity to check for

Returns:DataBuffer

this buffer

Annotations
@Override
factoryback to summary
public DataBufferFactory factory()

Implements org.springframework.core.io.buffer.DataBuffer.factory.

Doc from org.springframework.core.io.buffer.DataBuffer.factory.

Return the DataBufferFactory that created this buffer.

Returns:DataBufferFactory

the creating buffer factory

Annotations
@Override
getByteback to summary
public byte getByte(int index)

Implements org.springframework.core.io.buffer.DataBuffer.getByte.

Doc from org.springframework.core.io.buffer.DataBuffer.getByte.

Read a single byte at the given index from this data buffer.

Parameters
index:int

the index at which the byte will be read

Returns:byte

the byte at the given index

Annotations
@Override
indexOfback to summary
public int indexOf(IntPredicate predicate, int fromIndex)

Implements org.springframework.core.io.buffer.DataBuffer.indexOf.

Doc from org.springframework.core.io.buffer.DataBuffer.indexOf.

Return the index of the first byte in this buffer that matches the given predicate.

Parameters
predicate:IntPredicate

the predicate to match

fromIndex:int

the index to start the search from

Returns:int

the index of the first byte that matches predicate; or -1 if none match

Annotations
@Override
lastIndexOfback to summary
public int lastIndexOf(IntPredicate predicate, int fromIndex)

Implements org.springframework.core.io.buffer.DataBuffer.lastIndexOf.

Doc from org.springframework.core.io.buffer.DataBuffer.lastIndexOf.

Return the index of the last byte in this buffer that matches the given predicate.

Parameters
predicate:IntPredicate

the predicate to match

fromIndex:int

the index to start the search from

Returns:int

the index of the last byte that matches predicate; or -1 if none match

Annotations
@Override
readback to summary
public byte read()

Implements org.springframework.core.io.buffer.DataBuffer.read.

Doc from org.springframework.core.io.buffer.DataBuffer.read.

Read a single byte from the current reading position from this data buffer.

Returns:byte

the byte at this buffer's current reading position

Annotations
@Override
readback to summary
public DataBuffer read(byte[] destination)

Implements org.springframework.core.io.buffer.DataBuffer.read.

Doc from org.springframework.core.io.buffer.DataBuffer.read.

Read this buffer's data into the specified destination, starting at the current reading position of this buffer.

Parameters
destination:byte[]

the array into which the bytes are to be written

Returns:DataBuffer

this buffer

Annotations
@Override
readback to summary
public DataBuffer read(byte[] destination, int offset, int length)

Implements org.springframework.core.io.buffer.DataBuffer.read.

Doc from org.springframework.core.io.buffer.DataBuffer.read.

Read at most length bytes of this buffer into the specified destination, starting at the current reading position of this buffer.

Parameters
destination:byte[]

the array into which the bytes are to be written

offset:int

the index within destination of the first byte to be written

length:int

the maximum number of bytes to be written in destination

Returns:DataBuffer

this buffer

Annotations
@Override
readableByteBuffersback to summary
public DataBuffer.ByteBufferIterator readableByteBuffers()

Implements org.springframework.core.io.buffer.DataBuffer.readableByteBuffers.

Doc from org.springframework.core.io.buffer.DataBuffer.readableByteBuffers.

Returns a closeable iterator over each ByteBuffer in this data buffer that can be read. Calling this method is more efficient than toByteBuffer(), as no data is copied. However, the byte buffers provided can only be used during the iteration.

Note

that the returned iterator must be used in a try-with-resources clause or explicitly closed.

Returns:DataBuffer.ByteBufferIterator

a closeable iterator over the readable byte buffers contained in this data buffer

Annotations
@Override
readableByteCountback to summary
public int readableByteCount()

Implements org.springframework.core.io.buffer.DataBuffer.readableByteCount.

Doc from org.springframework.core.io.buffer.DataBuffer.readableByteCount.

Return the number of bytes that can be read from this data buffer.

Returns:int

the readable byte count

Annotations
@Override
readPositionback to summary
public int readPosition()

Implements org.springframework.core.io.buffer.DataBuffer.readPosition.

Doc from org.springframework.core.io.buffer.DataBuffer.readPosition.

Return the position from which this buffer will read.

Returns:int

the read position

Annotations
@Override
readPositionback to summary
public DataBuffer readPosition(int readPosition)

Implements org.springframework.core.io.buffer.DataBuffer.readPosition.

Doc from org.springframework.core.io.buffer.DataBuffer.readPosition.

Set the position from which this buffer will read.

Parameters
readPosition:int

the new read position

Returns:DataBuffer

this buffer

Annotations
@Override
retainedSliceback to summary
public DataBuffer retainedSlice(int index, int length)

Overrides default org.springframework.core.io.buffer.DataBuffer.retainedSlice.

Doc from org.springframework.core.io.buffer.DataBuffer.retainedSlice.

Deprecated

Create a new DataBuffer whose contents is a shared, retained subsequence of this data buffer's content. Data between this data buffer and the returned buffer is shared; though changes in the returned buffer's position will not be reflected in the reading nor writing position of this data buffer.

Note

that unlike slice(int, int), this method will call DataBufferUtils#retain(DataBuffer) (or equivalent) on the resulting slice.

Parameters
index:int

the index at which to start the slice

length:int

the length of the slice

Returns:DataBuffer

the specified, retained slice of this data buffer

Annotations
@Override
@Deprecated
sliceback to summary
public DataBuffer slice(int index, int length)

Implements org.springframework.core.io.buffer.DataBuffer.slice.

Doc from org.springframework.core.io.buffer.DataBuffer.slice.

Deprecated

Create a new DataBuffer whose contents is a shared subsequence of this data buffer's content. Data between this data buffer and the returned buffer is shared; though changes in the returned buffer's position will not be reflected in the reading nor writing position of this data buffer.

Note

that this method will not call DataBufferUtils#retain(DataBuffer) on the resulting slice: the reference count will not be increased.

Parameters
index:int

the index at which to start the slice

length:int

the length of the slice

Returns:DataBuffer

the specified slice of this data buffer

Annotations
@Override
@Deprecated
splitback to summary
public DataBuffer split(int index)

Implements org.springframework.core.io.buffer.DataBuffer.split.

Doc from org.springframework.core.io.buffer.DataBuffer.split.

Splits this data buffer into two at the given index.

Data that precedes the index will be returned in a new buffer, while this buffer will contain data that follows after index. Memory between the two buffers is shared, but independent and cannot overlap (unlike slice).

The read and write position of the returned buffer are truncated to fit within the buffers capacity if necessary. The positions of this buffer are set to 0 if they are smaller than index.

Parameters
index:int

the index at which it should be split

Returns:DataBuffer

a new data buffer, containing the bytes from index 0 to index

Annotations
@Override
toByteBufferback to summary
public ByteBuffer toByteBuffer()

Overrides default org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Deprecated

Returns a ByteBuffer representation of this data buffer. Data between this DataBuffer and the returned ByteBuffer is not shared.

Returns:ByteBuffer

this data buffer as a byte buffer

Annotations
@Override
@Deprecated
toByteBufferback to summary
public ByteBuffer toByteBuffer(int index, int length)

Implements org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Deprecated

Returns a ByteBuffer representation of a subsequence of this buffer's bytes. Data between this DataBuffer and the returned ByteBuffer is not shared.

Returns:ByteBuffer

this data buffer as a byte buffer

Annotations
@Override
@Deprecated
toByteBufferback to summary
public void toByteBuffer(ByteBuffer dest)

Overrides default org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Copies this entire data buffer into the given destination ByteBuffer, beginning at the current reading position, and the current position of destination byte buffer.

Parameters
dest:ByteBuffer

the destination byte buffer

Annotations
@Override
toByteBufferback to summary
public void toByteBuffer(int srcPos, ByteBuffer dest, int destPos, int length)

Implements org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Doc from org.springframework.core.io.buffer.DataBuffer.toByteBuffer.

Copies the given length from this data buffer into the given destination ByteBuffer, beginning at the given source position, and the given destination position in the destination byte buffer.

Parameters
srcPos:int

the position of this data buffer from where copying should start

dest:ByteBuffer

the destination byte buffer

destPos:int

the position in dest to where copying should start

length:int

the amount of data to copy

Annotations
@Override
toStringback to summary
public String toString(Charset charset)

Overrides default org.springframework.core.io.buffer.DataBuffer.toString.

Doc from org.springframework.core.io.buffer.DataBuffer.toString.

Return this buffer's data a String using the specified charset. Default implementation delegates to toString(readPosition(), readableByteCount(), charset).

Parameters
charset:Charset

the character set to use

Returns:String

a string representation of all this buffers data

Annotations
@Override
toStringback to summary
public String toString(int index, int length, Charset charset)

Implements org.springframework.core.io.buffer.DataBuffer.toString.

Doc from org.springframework.core.io.buffer.DataBuffer.toString.

Return a part of this buffer's data as a String using the specified charset.

Parameters
index:int

the index at which to start the string

length:int

the number of bytes to use for the string

charset:Charset

the charset to use

Returns:String

a string representation of a part of this buffers data

Annotations
@Override
writableByteBuffersback to summary
public DataBuffer.ByteBufferIterator writableByteBuffers()

Implements org.springframework.core.io.buffer.DataBuffer.writableByteBuffers.

Doc from org.springframework.core.io.buffer.DataBuffer.writableByteBuffers.

Returns a closeable iterator over each ByteBuffer in this data buffer that can be written to. The byte buffers provided can only be used during the iteration.

Note

that the returned iterator must be used in a try-with-resources clause or explicitly closed.

Returns:DataBuffer.ByteBufferIterator

a closeable iterator over the writable byte buffers contained in this data buffer

Annotations
@Override
writableByteCountback to summary
public int writableByteCount()

Implements org.springframework.core.io.buffer.DataBuffer.writableByteCount.

Doc from org.springframework.core.io.buffer.DataBuffer.writableByteCount.

Return the number of bytes that can be written to this data buffer.

Returns:int

the writable byte count

Annotations
@Override
writeback to summary
public DataBuffer write(byte b)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write a single byte into this buffer at the current writing position.

Parameters
b:byte

the byte to be written

Returns:DataBuffer

this buffer

Annotations
@Override
writeback to summary
public DataBuffer write(byte[] source)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write the given source into this buffer, starting at the current writing position of this buffer.

Parameters
source:byte[]

the bytes to be written into this buffer

Returns:DataBuffer

this buffer

Annotations
@Override
writeback to summary
public DataBuffer write(byte[] source, int offset, int length)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write at most length bytes of the given source into this buffer, starting at the current writing position of this buffer.

Parameters
source:byte[]

the bytes to be written into this buffer

offset:int

the index within source to start writing from

length:int

the maximum number of bytes to be written from source

Returns:DataBuffer

this buffer

Annotations
@Override
writeback to summary
public DataBuffer write(DataBuffer... buffers)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write one or more DataBuffers to this buffer, starting at the current writing position. It is the responsibility of the caller to release the given data buffers.

Parameters
buffers:DataBuffer[]

the byte buffers to write into this buffer

Returns:DataBuffer

this buffer

Annotations
@Override
writeback to summary
public DataBuffer write(ByteBuffer... buffers)

Implements org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write one or more ByteBuffer to this buffer, starting at the current writing position.

Parameters
buffers:ByteBuffer[]

the byte buffers to write into this buffer

Returns:DataBuffer

this buffer

Annotations
@Override
writeback to summary
public DataBuffer write(CharSequence charSequence, Charset charset)

Overrides default org.springframework.core.io.buffer.DataBuffer.write.

Doc from org.springframework.core.io.buffer.DataBuffer.write.

Write the given CharSequence using the given Charset, starting at the current writing position.

Parameters
charSequence:CharSequence

the char sequence to write into this buffer

charset:Charset

the charset to encode the char sequence with

Returns:DataBuffer

this buffer

Annotations
@Override
writePositionback to summary
public int writePosition()

Implements org.springframework.core.io.buffer.DataBuffer.writePosition.

Doc from org.springframework.core.io.buffer.DataBuffer.writePosition.

Return the position to which this buffer will write.

Returns:int

the write position

Annotations
@Override
writePositionback to summary
public DataBuffer writePosition(int writePosition)

Implements org.springframework.core.io.buffer.DataBuffer.writePosition.

Doc from org.springframework.core.io.buffer.DataBuffer.writePosition.

Set the position to which this buffer will write.

Parameters
writePosition:int

the new write position

Returns:DataBuffer

this buffer

Annotations
@Override