title: What is the best way to convert a byte array to an IntStream?
body: <p>Java 8 has java.util.stream.Stream and java.util.stream.IntStream types. java.util.Arrays has a method</p>
  
  <pre><code>IntStream is = Arrays.stream(int[])
  </code></pre>
  
  <p>but no such method to make an IntStream from a byte[], short[] or char[], widening each element to an int. Is there an idiomatic/preferred way to create an IntStream from a byte[], so I can operate on byte arrays in a functional manner?</p>
  
  <p>I can of course trivially convert the byte[] to int[] manually and use Arrays.stream(int[]), or use IntStream.Builder:</p>
  
  <pre><code>public static IntStream stream(byte[] bytes) {
     IntStream.Builder isb = IntStream.builder();
     for (byte b: bytes) 
         isb.add((int) b); 
     return isb.build();
  }
  </code></pre>
  
  <p>but neither is very functional due to the copying of the source.</p>
  
  <p>There also does not seem to be an easy way to convert an InputStream (or in this case an ByteArrayInputStream) to an IntStream, which would be very useful for processing InputStream functionally. (Glaring omission?)</p>
  
  <p>Is there a more functional way that is efficient and does not copy?</p>