More minor code improvements
[zxing.git] / core / src / com / google / zxing / qrcode / decoder / BitSource.java
index b58ec92..c19e34d 100755 (executable)
 package com.google.zxing.qrcode.decoder;\r
 \r
 /**\r
- * This provides an easy abstraction to read bits at a time from a sequence of bytes, where the\r
- * number of bits read is not often a multiple of 8.\r
+ * <p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the\r
+ * number of bits read is not often a multiple of 8.</p>\r
+ *\r
+ * <p>This class is not thread-safe.</p>\r
  *\r
  * @author srowen@google.com (Sean Owen)\r
  */\r
@@ -28,11 +30,18 @@ final class BitSource {
   private int byteOffset;\r
   private int bitOffset;\r
 \r
+  /**\r
+   * @param bytes bytes from which this will read bits. Bits will be read from the first byte first.\r
+   * Bits are read within a byte from most-significant to least-significant bit.\r
+   */\r
   BitSource(byte[] bytes) {\r
     this.bytes = bytes;\r
   }\r
 \r
   /**\r
+   * @param numBits number of bits to read\r
+   * @return int representing the bits read. The bits will appear as the least-significant\r
+   *         bits of the int\r
    * @throws IllegalArgumentException if numBits isn't in [1,32]\r
    */\r
   int readBits(int numBits) {\r
@@ -77,6 +86,9 @@ final class BitSource {
     return result;\r
   }\r
 \r
+  /**\r
+   * @return number of bits that can be read successfully\r
+   */\r
   int available() {\r
     return 8 * (bytes.length - byteOffset) - bitOffset;\r
   }\r