Java Code Examples for org.apache.hadoop.io.WritableUtils#readCompressedByteArray()
The following examples show how to use
org.apache.hadoop.io.WritableUtils#readCompressedByteArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EdgeValueWritable.java From hgraphdb with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public void readFields(final DataInput input) throws IOException { try { Kryo kryo = new Kryo(); kryo.register(HBaseEdge.class, new HBaseEdgeSerializer()); final ByteArrayInputStream bais = new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input)); this.edge = kryo.readObject(new Input(bais), HBaseEdge.class); Class<? extends Writable> cls = Class.forName(Text.readString(input)).asSubclass(Writable.class); Writable writable; if (cls.equals(NullWritable.class)) { writable = NullWritable.get(); } else { writable = cls.newInstance(); } writable.readFields(input); this.value = writable != NullWritable.get() ? (V) writable : null; } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { throw new IOException("Failed writable init", e); } }
Example 2
Source File: VertexValueWritable.java From hgraphdb with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public void readFields(final DataInput input) throws IOException { try { Kryo kryo = new Kryo(); kryo.register(HBaseVertex.class, new HBaseVertexSerializer()); final ByteArrayInputStream bais = new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input)); this.vertex = kryo.readObject(new Input(bais), HBaseVertex.class); Class<? extends Writable> cls = Class.forName(Text.readString(input)).asSubclass(Writable.class); Writable writable; if (cls.equals(NullWritable.class)) { writable = NullWritable.get(); } else { writable = cls.newInstance(); } writable.readFields(input); this.value = writable != NullWritable.get() ? (V) writable : null; } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { throw new IOException("Failed writable init", e); } }
Example 3
Source File: Warp10InputSplit.java From warp10-platform with Apache License 2.0 | 6 votes |
@Override public void readFields(DataInput in) throws IOException { // // Read fetchers // int nfetchers = WritableUtils.readVInt(in); this.fetchers = new String[nfetchers]; for (int i = 0; i < nfetchers; i++) { String currentFetcher = WritableUtils.readString(in); this.fetchers[i] = currentFetcher; } // // Read splits // int splitsize = WritableUtils.readVInt(in); this.splits = WritableUtils.readCompressedByteArray(in); this.complete = true; }
Example 4
Source File: EncodedQualifiersColumnProjectionFilter.java From phoenix with Apache License 2.0 | 6 votes |
@Override public void readFields(DataInput input) throws IOException { this.emptyCFName = WritableUtils.readCompressedByteArray(input); int bitsetLongArraySize = WritableUtils.readVInt(input); long[] bitsetLongArray = new long[bitsetLongArraySize]; for (int i = 0; i < bitsetLongArraySize; i++) { bitsetLongArray[i] = WritableUtils.readVLong(input); } this.trackedColumns = BitSet.valueOf(bitsetLongArray); this.encodingScheme = QualifierEncodingScheme.values()[WritableUtils.readVInt(input)]; int conditionOnlyCfsSize = WritableUtils.readVInt(input); this.conditionOnlyCfs = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR); while (conditionOnlyCfsSize > 0) { this.conditionOnlyCfs.add(WritableUtils.readCompressedByteArray(input)); conditionOnlyCfsSize--; } }
Example 5
Source File: Geometry.java From datawave with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { readMetadata(in); byte[] wellKnownBinary = WritableUtils.readCompressedByteArray(in); try { geometry = new WKBReader().read(wellKnownBinary); } catch (ParseException e) { throw new IllegalArgumentException("Cannot parse the geometry", e); } validate(); }
Example 6
Source File: Cardinality.java From datawave with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { readMetadata(in); content = new FieldValueCardinality(); content.lower = WritableUtils.readString(in); content.upper = WritableUtils.readString(in); byte[] cardArray = WritableUtils.readCompressedByteArray(in); content.estimate = HyperLogLogPlus.Builder.build(cardArray); }
Example 7
Source File: ObjectWritable.java From hgraphdb with Apache License 2.0 | 4 votes |
@Override public void readFields(final DataInput input) throws IOException { final byte[] serialized = WritableUtils.readCompressedByteArray(input); this.t = ValueUtils.deserialize(serialized); }
Example 8
Source File: RowKeyComparisonFilter.java From phoenix with Apache License 2.0 | 4 votes |
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); this.essentialCF = WritableUtils.readCompressedByteArray(input); }
Example 9
Source File: VertexWritable.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void readFields(final DataInput input) throws IOException { this.vertex = null; final ByteArrayInputStream bais = new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input)); this.vertex = ((StarGraph)KryoShimServiceLoader.readClassAndObject(bais)).getStarVertex(); // read the star graph; }
Example 10
Source File: ObjectWritable.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void readFields(final DataInput input) throws IOException { final ByteArrayInputStream bais = new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input)); this.t = KryoShimServiceLoader.readClassAndObject(bais); }
Example 11
Source File: RowKeyComparisonFilter.java From phoenix with Apache License 2.0 | 4 votes |
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); this.essentialCF = WritableUtils.readCompressedByteArray(input); }
Example 12
Source File: RowKeyComparisonFilter.java From phoenix with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); this.essentialCF = WritableUtils.readCompressedByteArray(input); }