< prev index next >

src/java.base/share/classes/java/nio/X-Buffer.java.template

Print this page
rev 57242 : imported patch 8234049.patch

*** 35,44 **** --- 35,45 ---- import java.util.stream.StreamSupport; import java.util.stream.$Streamtype$Stream; #end[streamableType] import java.util.Objects; + import jdk.internal.access.foreign.MemorySegmentProxy; import jdk.internal.util.ArraysSupport; /** * $A$ $type$ buffer. *
*** 277,297 **** // Creates a new buffer with the given mark, position, limit, capacity, // backing array, and array offset // $Type$Buffer(int mark, int pos, int lim, int cap, // package-private ! $type$[] hb, int offset) { ! super(mark, pos, lim, cap); this.hb = hb; this.offset = offset; } // Creates a new buffer with the given mark, position, limit, and capacity // ! $Type$Buffer(int mark, int pos, int lim, int cap) { // package-private ! this(mark, pos, lim, cap, null, 0); } @Override Object base() { return hb; --- 278,306 ---- // Creates a new buffer with the given mark, position, limit, capacity, // backing array, and array offset // $Type$Buffer(int mark, int pos, int lim, int cap, // package-private ! $type$[] hb, int offset, MemorySegmentProxy segment) { ! super(mark, pos, lim, cap, segment); this.hb = hb; this.offset = offset; } // Creates a new buffer with the given mark, position, limit, and capacity // ! $Type$Buffer(int mark, int pos, int lim, int cap, MemorySegmentProxy segment) { // package-private ! this(mark, pos, lim, cap, null, 0, segment); ! } ! ! // Creates a new buffer with given base, address and capacity ! // ! $Type$Buffer($type$[] hb, long addr, int cap, MemorySegmentProxy segment) { // package-private ! super(addr, cap, segment); ! this.hb = hb; ! this.offset = 0; } @Override Object base() { return hb;
*** 346,356 **** * If the {@code capacity} is a negative integer */ public static $Type$Buffer allocate(int capacity) { if (capacity < 0) throw createCapacityException(capacity); ! return new Heap$Type$Buffer(capacity, capacity); } /** * Wraps $a$ $type$ array into a buffer. * --- 355,365 ---- * If the {@code capacity} is a negative integer */ public static $Type$Buffer allocate(int capacity) { if (capacity < 0) throw createCapacityException(capacity); ! return new Heap$Type$Buffer(capacity, capacity, null); } /** * Wraps $a$ $type$ array into a buffer. *
*** 391,401 **** */ public static $Type$Buffer wrap($type$[] array, int offset, int length) { try { ! return new Heap$Type$Buffer(array, offset, length); } catch (IllegalArgumentException x) { throw new IndexOutOfBoundsException(); } } --- 400,410 ---- */ public static $Type$Buffer wrap($type$[] array, int offset, int length) { try { ! return new Heap$Type$Buffer(array, offset, length, null); } catch (IllegalArgumentException x) { throw new IndexOutOfBoundsException(); } }
< prev index next >