(DataOutput out, boolean[] v, boolean extra)
| 147 | } |
| 148 | |
| 149 | public static void writeBooleanArray(DataOutput out, boolean[] v, boolean extra) throws IOException { |
| 150 | int len = v.length + 1; |
| 151 | for (int chunk = 0; chunk < len; chunk += 8) { |
| 152 | byte encoding = 0; |
| 153 | for (int i = chunk; i < len && i < chunk + 8; i++) { |
| 154 | encoding <<= 1; |
| 155 | if (i == v.length) { |
| 156 | encoding += extra ? 1 : 0; //v[len] is the extra piece |
| 157 | } else { |
| 158 | encoding += v[i] ? 1 : 0; |
| 159 | } |
| 160 | } |
| 161 | out.writeByte(encoding); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | public static void writeBooleanArray(DataOutput out, boolean[] v) throws IOException { |
| 166 | for (int chunk = 0; chunk < v.length; chunk += 8) { |
no outgoing calls
no test coverage detected