jdk/src/share/classes/java/nio/X-Buffer.java.template
changeset 17922 d56eec572de5
parent 14342 8435a30053c1
child 18156 edb590d448c5
--- a/jdk/src/share/classes/java/nio/X-Buffer.java.template	Fri May 31 09:30:44 2013 +0100
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template	Fri May 31 12:17:30 2013 +0100
@@ -30,6 +30,11 @@
 #if[char]
 import java.io.IOException;
 #end[char]
+#if[streamableType]
+import java.util.Spliterator;
+import java.util.stream.StreamSupport;
+import java.util.stream.$Streamtype$Stream;
+#end[streamableType]
 
 /**
  * $A$ $type$ buffer.
@@ -589,6 +594,19 @@
      */
     public abstract $type$ get(int index);
 
+#if[streamableType]
+    /**
+     * Absolute <i>get</i> method.  Reads the $type$ at the given
+     * index without any validation of the index.
+     *
+     * @param  index
+     *         The index from which the $type$ will be read
+     *
+     * @return  The $type$ at the given index
+     */
+    abstract $type$ getUnchecked(int index);   // package-private
+#end[streamableType]
+
     /**
      * Absolute <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
      *
@@ -1458,4 +1476,16 @@
 
 #end[byte]
 
+#if[streamableType]
+
+#if[char]
+    @Override
+#end[char]
+    public $Streamtype$Stream $type$s() {
+        return StreamSupport.$streamtype$Stream(() -> new $Type$BufferSpliterator(this),
+            Buffer.SPLITERATOR_CHARACTERISTICS);
+    }
+
+#end[streamableType]
+
 }