@JsonCreator public static WrappedRange fromBytes(byte[] bytes) throws IOException { DataInput in = ByteStreams.newDataInput(bytes); Range range = new Range(); range.readFields(in); return new WrappedRange(range); } }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); int numRanges = in.readInt(); ranges = new ArrayList<>(numRanges); for (int i = 0; i < numRanges; ++i) { Range r = new Range(); r.readFields(in); ranges.add(r); } }
/** * Gets the ranges to scan over from a job. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @since 1.6.0 * @see #setRanges(Class, Configuration, Collection) */ public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException { Collection<String> encodedRanges = conf .getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES)); List<Range> ranges = new ArrayList<>(); for (String rangeString : encodedRanges) { ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString)); Range range = new Range(); range.readFields(new DataInputStream(bais)); ranges.add(range); } return ranges; }
@Override public void readFields(DataInput in) throws IOException { range.readFields(in); tableName = in.readUTF(); tableId = in.readUTF();
for (int i = 0; i < rangeSize; i++) { Range range = new Range(); range.readFields(dataInput); ranges.add(range);
public void readFields(DataInput in) throws IOException { ranges = Sets.newTreeSet(); int numLocs = in.readInt(); for (int i = 0; i < numLocs; ++i) { Range range = new Range(); range.readFields(in); ranges.add(range); } numLocs = in.readInt(); locations = new String[numLocs]; for (int i = 0; i < numLocs; ++i) locations[i] = in.readUTF(); }
private static Range decodeRange(String e) throws IOException { ByteArrayInputStream b = new ByteArrayInputStream(Base64.decodeBase64(e.getBytes())); DataInputStream in = new DataInputStream(b); Range range = new Range(); try { range.readFields(in); } catch (Exception e2) { throw new IOException(e2); } finally { in.close(); b.close(); } return range; }
public static Range decodeRange(String e) throws IOException { ByteArrayInputStream b = new ByteArrayInputStream(Base64.decodeBase64(e.getBytes())); DataInputStream in = new DataInputStream(b); Range range = new Range(); try { range.readFields(in); } catch (Exception e2) { throw new IOException(e2); } finally { in.close(); b.close(); } return range; }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); int numRanges = in.readInt(); ranges = new ArrayList<>(numRanges); for (int i = 0; i < numRanges; ++i) { Range r = new Range(); r.readFields(in); ranges.add(r); } }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); int numRanges = in.readInt(); ranges = new ArrayList<>(numRanges); for (int i = 0; i < numRanges; ++i) { Range r = new Range(); r.readFields(in); ranges.add(r); } }
@Override public void readFields(DataInput in) throws IOException { file = new Path(Text.readString(in)); start = in.readLong(); length = in.readLong(); hosts = null; int numberRanges = in.readInt(); for (int i = 0; i < numberRanges; i++) { Range range = new Range(); range.readFields(in); ranges.add(range); } }
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); int numRanges = in.readInt(); ranges = new ArrayList<>(numRanges); for (int i = 0; i < numRanges; ++i) { Range r = new Range(); r.readFields(in); ranges.add(r); } }
@Override public WritableComparable<?> getSplitComparable(final InputSplit inputSplit) throws IOException { //cannot get access to the range directly final AccumuloInputFormat.RangeInputSplit rangeInputSplit = (AccumuloInputFormat.RangeInputSplit) inputSplit; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final DataOutputStream out = new DataOutputStream(baos); rangeInputSplit.write(out); out.close(); final DataInputStream stream = new DataInputStream(new ByteArrayInputStream(baos.toByteArray())); final Range range = new Range(); range.readFields(stream); stream.close(); return range; } }
/** * Gets the ranges to scan over from a configuration object. * * @param conf * the Hadoop configuration object * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @see #setRanges(Job, Collection) */ protected static List<Range> getRanges(Configuration conf) throws IOException { String rangesPath = conf.get(RANGES); FileSystem fs = FileSystem.get(conf); FSDataInputStream inputStream = fs.open(new Path(rangesPath)); int size = inputStream.readInt(); ArrayList<Range> ranges = new ArrayList<>(); for (int i = 0; i < size; i++) { Range range = new Range(); range.readFields(inputStream); ranges.add(range); } inputStream.close(); return ranges; }
/** * Gets the ranges to scan over from a job. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @since 1.6.0 * @see #setRanges(Class, Configuration, Collection) */ public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException { Collection<String> encodedRanges = conf .getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES)); List<Range> ranges = new ArrayList<>(); for (String rangeString : encodedRanges) { ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString)); Range range = new Range(); range.readFields(new DataInputStream(bais)); ranges.add(range); } return ranges; }
/** * Gets the ranges to scan over from a job. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @since 1.6.0 * @see #setRanges(Class, Configuration, Collection) */ public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException { Collection<String> encodedRanges = conf .getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES)); List<Range> ranges = new ArrayList<>(); for (String rangeString : encodedRanges) { ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString)); Range range = new Range(); range.readFields(new DataInputStream(bais)); ranges.add(range); } return ranges; }
@Override public void readFields(DataInput in) throws IOException { range.readFields(in); tableName = in.readUTF(); tableId = in.readUTF();
for (int i = 0; i < rangeSize; i++) { Range range = new Range(); range.readFields(dataInput); ranges.add(range);
/** * Gets the ranges to scan over from a job. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return the ranges * @throws IOException * if the ranges have been encoded improperly * @since 1.6.0 * @see #setRanges(Class, Configuration, Collection) */ public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException { Collection<String> encodedRanges = conf .getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES)); List<Range> ranges = new ArrayList<>(); for (String rangeString : encodedRanges) { ByteArrayInputStream bais = new ByteArrayInputStream( Base64.decodeBase64(rangeString.getBytes(UTF_8))); Range range = new Range(); range.readFields(new DataInputStream(bais)); ranges.add(range); } return ranges; }
for (int i = 0; i < rangeSize; i++) { Range range = new Range(); range.readFields(dataInput); ranges.add(range);