ByteArrayInputStream vs own class
<p>I was wondering whether is <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/io/ByteArrayInputStream.html" rel="nofollow">ByteArrayInputStream</a> class from java.io package good to be used? Or if it were to be compared with own class by using byte arrays such as:</p>

<pre><code>private int pos = 0;
private final byte[] total;

public Reader(final byte[] total) {
    this.total = total;
}

public int read() {
    return ((int) total[pos++]) &amp; 0xFF;
}
</code></pre>

<p>The bytes isn't obtained from a file, it was supposed to be a server receiving bytes/packets. The function does the same as the one in ByteArrayInputStream. I was curious if ByteArrayInputStream class would be used, does it increase the amount of bytes placed into the java's memory? But basically, in performance wise, which would be more recommended?</p>

<p>Thank you.</p>

<p>EDIT* I think I've got my answer, i was wondering what's the difference between mark() and skip() method in it? The function seemed to be the same, just that one changes the position, and one reads bytes to skip them.</p>
