@Override public void write(DataOutput out) throws IOException { TableSnapshotRegionSplit.Builder builder = TableSnapshotRegionSplit.newBuilder() .setTable(htd.convert()) .setRegion(HRegionInfo.convert(regionInfo)); for (String location : locations) { builder.addLocations(location); } TableSnapshotRegionSplit split = builder.build(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); split.writeTo(baos); baos.close(); byte[] buf = baos.toByteArray(); out.writeInt(buf.length); out.write(buf); Bytes.writeByteArray(out, Bytes.toBytes(scan)); Bytes.writeByteArray(out, Bytes.toBytes(restoreDir)); }
@Override public void write(DataOutput out) throws IOException { TableSnapshotRegionSplit.Builder builder = TableSnapshotRegionSplit.newBuilder() .setTable(htd.convert()) .setRegion(HRegionInfo.convert(regionInfo)); for (String location : locations) { builder.addLocations(location); } TableSnapshotRegionSplit split = builder.build(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); split.writeTo(baos); baos.close(); byte[] buf = baos.toByteArray(); out.writeInt(buf.length); out.write(buf); }
@Override public void readFields(DataInput in) throws IOException { int len = in.readInt(); byte[] buf = new byte[len]; in.readFully(buf); TableSnapshotRegionSplit split = TableSnapshotRegionSplit.PARSER.parseFrom(buf); this.htd = HTableDescriptor.convert(split.getTable()); this.regionInfo = HRegionInfo.convert(split.getRegion()); List<String> locationsList = split.getLocationsList(); this.locations = locationsList.toArray(new String[locationsList.size()]); this.scan = Bytes.toString(Bytes.readByteArray(in)); this.restoreDir = Bytes.toString(Bytes.readByteArray(in)); }
@Override public void readFields(DataInput in) throws IOException { int len = in.readInt(); byte[] buf = new byte[len]; in.readFully(buf); TableSnapshotRegionSplit split = TableSnapshotRegionSplit.PARSER.parseFrom(buf); this.htd = HTableDescriptor.convert(split.getTable()); this.regionInfo = HRegionInfo.convert(split.getRegion()); List<String> locationsList = split.getLocationsList(); this.locations = locationsList.toArray(new String[locationsList.size()]); }