# Uses of Class
java.nio.Buffer

Packages that use Buffer
Package
Description
java.lang.foreign
Provides low-level access to memory and functions outside the Java runtime.
java.nio
Defines buffers, which are containers for data, and provides an overview of the other NIO packages.

## Uses of Buffer in java.lang.foreign

Methods in java.lang.foreign with parameters of type Buffer
Modifier and Type
Method
Description
`static MemorySegment`
MemorySegment.`ofBuffer(Buffer buffer)`
Creates a memory segment that is backed by the same region of memory that backs the given `Buffer` instance.

## Uses of Buffer in java.nio

Subclasses of Buffer in java.nio
Modifier and Type
Class
Description
`class`
`ByteBuffer`
A byte buffer.
`class`
`CharBuffer`
A char buffer.
`class`
`DoubleBuffer`
A double buffer.
`class`
`FloatBuffer`
A float buffer.
`class`
`IntBuffer`
An int buffer.
`class`
`LongBuffer`
A long buffer.
`class`
`MappedByteBuffer`
A direct byte buffer whose content is a memory-mapped region of a file.
`class`
`ShortBuffer`
A short buffer.
Methods in java.nio that return Buffer
Modifier and Type
Method
Description
`Buffer`
Buffer.`clear()`
Clears this buffer.
`abstract Buffer`
Buffer.`duplicate()`
Creates a new buffer that shares this buffer's content.
`Buffer`
Buffer.`flip()`
Flips this buffer.
`Buffer`
Buffer.`limit(int newLimit)`
Sets this buffer's limit.
`Buffer`
Buffer.`mark()`
Sets this buffer's mark at its position.
`Buffer`
Buffer.`position(int newPosition)`
Sets this buffer's position.
`Buffer`
Buffer.`reset()`
Resets this buffer's position to the previously-marked position.
`Buffer`
Buffer.`rewind()`
Rewinds this buffer.
`abstract Buffer`
Buffer.`slice()`
Creates a new buffer whose content is a shared subsequence of this buffer's content.
`abstract Buffer`
Buffer.`slice(int index, int length)`
Creates a new buffer whose content is a shared subsequence of this buffer's content.