MCPcopy Create free account
hub / github.com/apache/pig / writeBooleanArray

Method writeBooleanArray

src/org/apache/pig/data/utils/SedesHelper.java:149–163  ·  view source on GitHub ↗
(DataOutput out, boolean[] v, boolean extra)

Source from the content-addressed store, hash-verified

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) {

Callers 2

writeElementsMethod · 0.95
writeElementsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected