Java : Readable with Examples
Readable (Java SE 22 & JDK 22) with Examples.
You will find code examples on most Readable methods.
Summary
final Readable readable = CharBuffer.wrap("abc");
final var cb = CharBuffer.allocate(5);
System.out.println(readable.read(cb)); // 3
System.out.println(Arrays.toString(cb.array())); // [a, b, c, , ]
Methods
int read (CharBuffer cb)
final Readable readable = CharBuffer.wrap("abc");
final var cb = CharBuffer.allocate(5);
System.out.println(readable.read(cb)); // 3
System.out.println(Arrays.toString(cb.array())); // [a, b, c, , ]
final Readable readable = CharBuffer.wrap("abcdXYZ");
final var cb1 = CharBuffer.allocate(5);
System.out.println(readable.read(cb1)); // 5
System.out.println(Arrays.toString(cb1.array())); // [a, b, c, d, X]
final var cb2 = CharBuffer.allocate(5);
System.out.println(readable.read(cb2)); // 2
System.out.println(Arrays.toString(cb2.array())); // [Y, Z, , , ]