UNPKG

cassandra-server

Version:

A thin Javascript wrapper around Apache Cassandra to provide out of the box server support

583 lines (582 loc) 23.2 kB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_67) on Sun Sep 07 15:29:32 CEST 2014 --> <title>FastByteArrayInputStream (apache-cassandra API)</title> <meta name="date" content="2014-09-07"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="FastByteArrayInputStream (apache-cassandra API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/FastByteArrayInputStream.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/apache/cassandra/io/util/DiskAwareRunnable.html" title="class in org.apache.cassandra.io.util"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayOutputStream.html" title="class in org.apache.cassandra.io.util"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/cassandra/io/util/FastByteArrayInputStream.html" target="_top">Frames</a></li> <li><a href="FastByteArrayInputStream.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.cassandra.io.util</div> <h2 title="Class FastByteArrayInputStream" class="title">Class FastByteArrayInputStream</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>java.io.InputStream</li> <li> <ul class="inheritance"> <li>org.apache.cassandra.io.util.FastByteArrayInputStream</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.io.Closeable, java.lang.AutoCloseable</dd> </dl> <hr> <br> <pre>public class <span class="strong">FastByteArrayInputStream</span> extends java.io.InputStream</pre> <div class="block">A specialized <code>InputStream</code> for reading the contents of a byte array.</div> <dl><dt><span class="strong">See Also:</span></dt><dd><code>ByteArrayInputStream</code></dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field_summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>protected byte[]</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#buf">buf</a></strong></code> <div class="block">The <code>byte</code> array containing the bytes to stream over.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#count">count</a></strong></code> <div class="block">The total number of bytes initially available in the byte array <code>buf</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#mark">mark</a></strong></code> <div class="block">The current mark position.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#pos">pos</a></strong></code> <div class="block">The current position within the byte array.</div> </td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#FastByteArrayInputStream(byte[])">FastByteArrayInputStream</a></strong>(byte[]&nbsp;buf)</code> <div class="block">Constructs a new <code>ByteArrayInputStream</code> on the byte array <code>buf</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#FastByteArrayInputStream(byte[],%20int,%20int)">FastByteArrayInputStream</a></strong>(byte[]&nbsp;buf, int&nbsp;offset, int&nbsp;length)</code> <div class="block">Constructs a new <code>ByteArrayInputStream</code> on the byte array <code>buf</code> with the initial position set to <code>offset</code> and the number of bytes available set to <code>offset</code> + <code>length</code>.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#available()">available</a></strong>()</code> <div class="block">Returns the number of bytes that are available before this stream will block.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#close()">close</a></strong>()</code> <div class="block">Closes this stream and frees resources associated with this stream.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#mark(int)">mark</a></strong>(int&nbsp;readlimit)</code> <div class="block">Sets a mark position in this ByteArrayInputStream.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#markSupported()">markSupported</a></strong>()</code> <div class="block">Indicates whether this stream supports the <code>mark()</code> and <code>reset()</code> methods.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#read()">read</a></strong>()</code> <div class="block">Reads a single byte from the source byte array and returns it as an integer in the range from 0 to 255.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#read(byte[],%20int,%20int)">read</a></strong>(byte[]&nbsp;b, int&nbsp;offset, int&nbsp;length)</code> <div class="block">Reads at most <code>len</code> bytes from this stream and stores them in byte array <code>b</code> starting at <code>offset</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#reset()">reset</a></strong>()</code> <div class="block">Resets this stream to the last marked location.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#skip(long)">skip</a></strong>(long&nbsp;n)</code> <div class="block">Skips <code>count</code> number of bytes in this InputStream.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.io.InputStream"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.io.InputStream</h3> <code>read</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field_detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="buf"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>buf</h4> <pre>protected&nbsp;byte[] buf</pre> <div class="block">The <code>byte</code> array containing the bytes to stream over.</div> </li> </ul> <a name="pos"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>pos</h4> <pre>protected&nbsp;int pos</pre> <div class="block">The current position within the byte array.</div> </li> </ul> <a name="mark"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mark</h4> <pre>protected&nbsp;int mark</pre> <div class="block">The current mark position. Initially set to 0 or the <code>offset</code> parameter within the constructor.</div> </li> </ul> <a name="count"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>count</h4> <pre>protected&nbsp;int count</pre> <div class="block">The total number of bytes initially available in the byte array <code>buf</code>.</div> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="FastByteArrayInputStream(byte[])"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>FastByteArrayInputStream</h4> <pre>public&nbsp;FastByteArrayInputStream(byte[]&nbsp;buf)</pre> <div class="block">Constructs a new <code>ByteArrayInputStream</code> on the byte array <code>buf</code>.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buf</code> - the byte array to stream over.</dd></dl> </li> </ul> <a name="FastByteArrayInputStream(byte[], int, int)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>FastByteArrayInputStream</h4> <pre>public&nbsp;FastByteArrayInputStream(byte[]&nbsp;buf, int&nbsp;offset, int&nbsp;length)</pre> <div class="block">Constructs a new <code>ByteArrayInputStream</code> on the byte array <code>buf</code> with the initial position set to <code>offset</code> and the number of bytes available set to <code>offset</code> + <code>length</code>.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buf</code> - the byte array to stream over.</dd><dd><code>offset</code> - the initial position in <code>buf</code> to start streaming from.</dd><dd><code>length</code> - the number of bytes available for streaming.</dd></dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="available()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>available</h4> <pre>public&nbsp;int&nbsp;available()</pre> <div class="block">Returns the number of bytes that are available before this stream will block. This method returns the number of bytes yet to be read from the source byte array.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>available</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Returns:</span></dt><dd>the number of bytes available before blocking.</dd></dl> </li> </ul> <a name="close()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>close</h4> <pre>public&nbsp;void&nbsp;close() throws java.io.IOException</pre> <div class="block">Closes this stream and frees resources associated with this stream.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>close</code>&nbsp;in interface&nbsp;<code>java.io.Closeable</code></dd> <dt><strong>Specified by:</strong></dt> <dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd> <dt><strong>Overrides:</strong></dt> <dd><code>close</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.io.IOException</code> - if an I/O error occurs while closing this stream.</dd></dl> </li> </ul> <a name="mark(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mark</h4> <pre>public&nbsp;void&nbsp;mark(int&nbsp;readlimit)</pre> <div class="block">Sets a mark position in this ByteArrayInputStream. The parameter <code>readlimit</code> is ignored. Sending <code>reset()</code> will reposition the stream back to the marked position.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>mark</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>readlimit</code> - ignored.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#markSupported()"><code>markSupported()</code></a>, <a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#reset()"><code>reset()</code></a></dd></dl> </li> </ul> <a name="markSupported()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>markSupported</h4> <pre>public&nbsp;boolean&nbsp;markSupported()</pre> <div class="block">Indicates whether this stream supports the <code>mark()</code> and <code>reset()</code> methods. Returns <code>true</code> since this class supports these methods.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>markSupported</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Returns:</span></dt><dd>always <code>true</code>.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#mark(int)"><code>mark(int)</code></a>, <a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#reset()"><code>reset()</code></a></dd></dl> </li> </ul> <a name="read()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>read</h4> <pre>public&nbsp;int&nbsp;read()</pre> <div class="block">Reads a single byte from the source byte array and returns it as an integer in the range from 0 to 255. Returns -1 if the end of the source array has been reached.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>read</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Returns:</span></dt><dd>the byte read or -1 if the end of this stream has been reached.</dd></dl> </li> </ul> <a name="read(byte[], int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>read</h4> <pre>public&nbsp;int&nbsp;read(byte[]&nbsp;b, int&nbsp;offset, int&nbsp;length)</pre> <div class="block">Reads at most <code>len</code> bytes from this stream and stores them in byte array <code>b</code> starting at <code>offset</code>. This implementation reads bytes from the source byte array.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>read</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>b</code> - the byte array in which to store the bytes read.</dd><dd><code>offset</code> - the initial position in <code>b</code> to store the bytes read from this stream.</dd><dd><code>length</code> - the maximum number of bytes to store in <code>b</code>.</dd> <dt><span class="strong">Returns:</span></dt><dd>the number of bytes actually read or -1 if no bytes were read and the end of the stream was encountered.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.lang.IndexOutOfBoundsException</code> - if <code>offset &lt; 0</code> or <code>length &lt; 0</code>, or if <code>offset + length</code> is greater than the size of <code>b</code>.</dd> <dd><code>java.lang.NullPointerException</code> - if <code>b</code> is <code>null</code>.</dd></dl> </li> </ul> <a name="reset()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>reset</h4> <pre>public&nbsp;void&nbsp;reset()</pre> <div class="block">Resets this stream to the last marked location. This implementation resets the position to either the marked position, the start position supplied in the constructor or 0 if neither has been provided.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>reset</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayInputStream.html#mark(int)"><code>mark(int)</code></a></dd></dl> </li> </ul> <a name="skip(long)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>skip</h4> <pre>public&nbsp;long&nbsp;skip(long&nbsp;n)</pre> <div class="block">Skips <code>count</code> number of bytes in this InputStream. Subsequent <code>read()</code>s will not return these bytes unless <code>reset()</code> is used. This implementation skips <code>count</code> number of bytes in the target stream. It does nothing and returns 0 if <code>n</code> is negative.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>skip</code>&nbsp;in class&nbsp;<code>java.io.InputStream</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>n</code> - the number of bytes to skip.</dd> <dt><span class="strong">Returns:</span></dt><dd>the number of bytes actually skipped.</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/FastByteArrayInputStream.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/apache/cassandra/io/util/DiskAwareRunnable.html" title="class in org.apache.cassandra.io.util"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../org/apache/cassandra/io/util/FastByteArrayOutputStream.html" title="class in org.apache.cassandra.io.util"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/cassandra/io/util/FastByteArrayInputStream.html" target="_top">Frames</a></li> <li><a href="FastByteArrayInputStream.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2014 The Apache Software Foundation</small></p> </body> </html>