private void doComparisonsOnRaw(ImmutableBytesWritable a, ImmutableBytesWritable b, int expectedSignum) throws IOException { ImmutableBytesWritable.Comparator comparator = new ImmutableBytesWritable.Comparator(); ByteArrayOutputStream baosA = new ByteArrayOutputStream(); ByteArrayOutputStream baosB = new ByteArrayOutputStream(); a.write(new DataOutputStream(baosA)); b.write(new DataOutputStream(baosB)); assertEquals( "Comparing " + a + " and " + b + " as raw", signum(comparator.compare(baosA.toByteArray(), 0, baosA.size(), baosB.toByteArray(), 0, baosB.size())), expectedSignum); assertEquals( "Comparing " + a + " and " + b + " as raw (inverse)", -signum(comparator.compare(baosB.toByteArray(), 0, baosB.size(), baosA.toByteArray(), 0, baosA.size())), expectedSignum); }
@Override public void write(DataOutput output) throws IOException { WritableUtils.writeString(output,tableName); rowkey.write(output); }
public void write(DataOutput out) throws IOException { out.writeByte(COLUMN_DESCRIPTOR_VERSION); Bytes.writeByteArray(out, this.name); out.writeInt(values.size()); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e: values.entrySet()) { e.getKey().write(out); e.getValue().write(out); } }
@Override public void write(DataOutput output) throws IOException { WritableUtils.writeString(output,tableName); rowkey.write(output); }
@Override public void write(DataOutput output) throws IOException { WritableUtils.writeString(output,tableName); rowkey.write(output); }
/** * @deprecated Writables are going away. Use {@link #toByteArray()} instead. */ @Deprecated public void write(DataOutput out) throws IOException { out.writeByte(COLUMN_DESCRIPTOR_VERSION); Bytes.writeByteArray(out, this.name); out.writeInt(values.size()); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e: values.entrySet()) { e.getKey().write(out); e.getValue().write(out); } out.writeInt(configuration.size()); for (Map.Entry<String, String> e : configuration.entrySet()) { new ImmutableBytesWritable(Bytes.toBytes(e.getKey())).write(out); new ImmutableBytesWritable(Bytes.toBytes(e.getValue())).write(out); } }
/** * <em> INTERNAL </em> This method is a part of {@link WritableComparable} interface * and is used for serialization of the HTableDescriptor over RPC */ @Override public void write(DataOutput out) throws IOException { out.writeInt(TABLE_DESCRIPTOR_VERSION); Bytes.writeByteArray(out, name); out.writeBoolean(isRootRegion()); out.writeBoolean(isMetaRegion()); out.writeInt(values.size()); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e: values.entrySet()) { e.getKey().write(out); e.getValue().write(out); } out.writeInt(families.size()); for(Iterator<HColumnDescriptor> it = families.values().iterator(); it.hasNext(); ) { HColumnDescriptor family = it.next(); family.write(out); } }
private void doComparisonsOnRaw(ImmutableBytesWritable a, ImmutableBytesWritable b, int expectedSignum) throws IOException { ImmutableBytesWritable.Comparator comparator = new ImmutableBytesWritable.Comparator(); ByteArrayOutputStream baosA = new ByteArrayOutputStream(); ByteArrayOutputStream baosB = new ByteArrayOutputStream(); a.write(new DataOutputStream(baosA)); b.write(new DataOutputStream(baosB)); assertEquals( "Comparing " + a + " and " + b + " as raw", signum(comparator.compare(baosA.toByteArray(), 0, baosA.size(), baosB.toByteArray(), 0, baosB.size())), expectedSignum); assertEquals( "Comparing " + a + " and " + b + " as raw (inverse)", -signum(comparator.compare(baosB.toByteArray(), 0, baosB.size(), baosA.toByteArray(), 0, baosA.size())), expectedSignum); }