Java Code Examples for com.esotericsoftware.kryo.io.Input#readInt()
The following examples show how to use
com.esotericsoftware.kryo.io.Input#readInt() .
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: FeatureSerializer.java From StormCV with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected Feature readObject(Kryo kryo, Input input, Class<Feature> clas, long requestId, String streamId, long sequenceNr) throws Exception { String name = input.readString(); long duration = input.readLong(); List<Descriptor> sparseDescriptors = kryo.readObject(input, ArrayList.class); int xl = input.readInt(); float[][][] denseDescriptor = null; if(xl > 0){ int yl = input.readInt(); int zl = input.readInt(); denseDescriptor = new float[xl][yl][zl]; for(int x=0; x<xl; x++){ for(int y=0; y<yl; y++){ for(int z=0; z<zl; z++){ denseDescriptor[x][y][z] = input.readFloat(); } } } } Feature feature = new Feature(streamId, sequenceNr, name, duration, sparseDescriptors, denseDescriptor); feature.setRequestId(requestId); return feature; }
Example 2
Source File: PercentileCounterSerializer.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Override public PercentileCounter read(Kryo kryo, Input input, Class type) { double compression = input.readDouble(); double quantileRatio = input.readDouble(); int length = input.readInt(); byte[] buffer = new byte[length]; int offset = 0; int bytesRead; while ((bytesRead = input.read(buffer, offset, buffer.length - offset)) != -1) { offset += bytesRead; if (offset >= buffer.length) { break; } } PercentileCounter counter = new PercentileCounter(compression, quantileRatio); counter.readRegisters(ByteBuffer.wrap(buffer)); return counter; }
Example 3
Source File: IntOperand.java From ytk-mp4j with MIT License | 6 votes |
public ArrayMetaData<int[]> read(Kryo kryo, Input input, Class<ArrayMetaData<int[]>> type) { try { int[] arrData = arrayMetaData.getArrData(); thatArrMetaData = arrayMetaData.recv(input); int arrSegNum = thatArrMetaData.getSegNum(); for (int i = 0; i < arrSegNum; i++) { int from = thatArrMetaData.getFrom(i); int to = thatArrMetaData.getTo(i); for (int j = from; j < to; j++) { arrData[j] = input.readInt(); } } thatArrMetaData.setArrData(arrData); } catch (IOException e) { LOG.error("double array read exception", e); System.exit(1); } return thatArrMetaData; }
Example 4
Source File: CollectionSerde.java From attic-apex-malhar with Apache License 2.0 | 6 votes |
@Override public CollectionT deserialize(Input input) { int numElements = input.readInt(true); try { CollectionT collection = collectionClass.newInstance(); for (int index = 0; index < numElements; index++) { T object = serde.deserialize(input); collection.add(object); } return collection; } catch (Exception ex) { throw Throwables.propagate(ex); } }
Example 5
Source File: EventFields.java From datawave with Apache License 2.0 | 5 votes |
@Override public void read(Kryo kryo, Input input) { // Read in the number of map entries int entries = input.readInt(true); for (int i = 0; i < entries; i++) { // Read in the key String key = input.readString(); // Read in the fields in the value int numBytes = input.readInt(true); ColumnVisibility vis = new ColumnVisibility(input.readBytes(numBytes)); numBytes = input.readInt(true); byte[] value = input.readBytes(numBytes); FieldValue fv = new FieldValue(vis, value); boolean hasContext = input.readBoolean(); if (hasContext) { fv.setContext(input.readString()); } boolean hasIsHit = input.readBoolean(); if (hasIsHit) { fv.setHit(input.readBoolean()); } map.put(key, fv); } }
Example 6
Source File: BitSetSerializer.java From onos with Apache License 2.0 | 5 votes |
@Override public BitSet read(Kryo kryo, Input input, Class<BitSet> aClass) { final int len = input.readInt(true); int bytesize = input.readInt(true); byte[] bytes = input.readBytes(bytesize); return BitSet.valueOf(bytes); }
Example 7
Source File: IntOperand.java From ytk-mp4j with MIT License | 5 votes |
public MapMetaData<Integer> read(Kryo kryo, Input input, Class<MapMetaData<Integer>> type) { try { thatMapMetaData = mapMetaData.recv(input); int thatMapSegNum = thatMapMetaData.getSegNum(); List<Map<String, Integer>> thatMapListData = new ArrayList<>(thatMapSegNum); List<Integer> thatDataNums = new ArrayList<>(thatMapSegNum); for (int i = 0; i < thatMapSegNum; i++) { Map<String, Integer> thisMapData = mapMetaData.getMapDataList().get(i); int dataNum = thatMapMetaData.getDataNum(i); for (int j = 0; j < dataNum; j++) { String key = input.readString(); Integer val = input.readInt(); Integer thisVal = thisMapData.get(key); if (thisVal == null) { thisMapData.put(key, val); } else { thisMapData.put(key, operator.apply(thisVal, val)); } } thatMapListData.add(thisMapData); thatDataNums.add(thisMapData.size()); } thatMapMetaData.setMapDataList(thatMapListData); thatMapMetaData.setDataNums(thatDataNums); } catch (IOException e) { LOG.error("double array read exception", e); System.exit(1); } return thatMapMetaData; }
Example 8
Source File: SVIntervalTree.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
@SuppressWarnings("unchecked") private SVIntervalTree( final Kryo kryo, final Input input ) { final SVInterval.Serializer intervalSerializer = new SVInterval.Serializer(); int size = input.readInt(); while ( size-- > 0 ) { final SVInterval interval = intervalSerializer.read(kryo, input, SVInterval.class); final V value = (V)kryo.readClassAndObject(input); put(interval, value); } }
Example 9
Source File: ComputeContentEvent.java From samoa with Apache License 2.0 | 5 votes |
@Override public ComputeContentEvent read(Kryo kryo, Input input, Class<ComputeContentEvent> type) { long splitId = input.readLong(true); long learningNodeId = input.readLong(true); int dataLength = input.readInt(true); double[] preSplitDist = new double[dataLength]; for(int i = 0; i < dataLength; i++){ preSplitDist[i] = input.readDouble(PRECISION, true); } return new ComputeContentEvent(splitId, learningNodeId, preSplitDist); }
Example 10
Source File: Cardinality.java From datawave with Apache License 2.0 | 5 votes |
@Override public void read(Kryo kryo, Input input) { super.readMetadata(kryo, input); content = new FieldValueCardinality(); this.content.lower = input.readString(); this.content.upper = input.readString(); int size = input.readInt(); byte[] cardArray = new byte[size]; input.read(cardArray); try { this.content.estimate = HyperLogLogPlus.Builder.build(cardArray); } catch (IOException e) { throw new RuntimeException(e); } }
Example 11
Source File: PTOperator.java From attic-apex-core with Apache License 2.0 | 5 votes |
@Override public void read(final Object object, final Input in) throws KryoException { PhysicalPlan plan = (PhysicalPlan)object; int operatorId = in.readInt(); int stateOrd = in.readInt(); plan.getAllOperators().get(operatorId).state = PTOperator.State.values()[stateOrd]; }
Example 12
Source File: PTContainer.java From Bats with Apache License 2.0 | 5 votes |
@Override public void read(final Object object, final Input in) throws KryoException { PhysicalPlan plan = (PhysicalPlan)object; int containerId = in.readInt(); for (PTContainer c : plan.getContainers()) { if (c.getId() == containerId) { int stateOrd = in.readInt(); c.state = PTContainer.State.values()[stateOrd]; c.containerId = in.readString(); c.resourceRequestPriority = in.readInt(); c.requiredMemoryMB = in.readInt(); c.allocatedMemoryMB = in.readInt(); c.requiredVCores = in.readInt(); c.allocatedVCores = in.readInt(); String bufferServerHost = in.readString(); if (bufferServerHost != null) { c.bufferServerAddress = InetSocketAddress.createUnresolved(bufferServerHost, in.readInt()); } c.host = in.readString(); c.nodeHttpAddress = in.readString(); int tokenLength = in.readInt(); if (tokenLength != -1) { c.bufferServerToken = in.readBytes(tokenLength); } else { c.bufferServerToken = null; } break; } } }
Example 13
Source File: HBaseEdgeSerializer.java From hgraphdb with Apache License 2.0 | 5 votes |
public HBaseEdge read(Kryo kryo, Input input, Class<? extends HBaseEdge> type) { HBaseEdge edge = super.read(kryo, input, type); int outVBytesLen = input.readInt(); Object outVId = ValueUtils.deserialize(input.readBytes(outVBytesLen)); int inVBytesLen = input.readInt(); Object inVId = ValueUtils.deserialize(input.readBytes(inVBytesLen)); edge.setOutVertex(new HBaseVertex(null, outVId)); edge.setInVertex(new HBaseVertex(null, inVId)); return edge; }
Example 14
Source File: ActivationSerializer.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public void read (Kryo kryo, Input in) { resultSetNumber = in.readInt(); }
Example 15
Source File: KryoWithCustomSerializersTest.java From flink with Apache License 2.0 | 4 votes |
@Override public LocalDate read(Kryo kryo, Input input, Class<LocalDate> type) { return new LocalDate(input.readInt(), input.readInt(), input.readInt()); }
Example 16
Source File: Person.java From tutorials with MIT License | 4 votes |
@Override public void read(Kryo kryo, Input input) { name = input.readString(); birthDate = new Date(input.readLong()); age = input.readInt(); }
Example 17
Source File: AvroKryoSerializerUtils.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public LocalTime read(Kryo kryo, Input input, Class<LocalTime> type) { final int time = input.readInt(true); return new LocalTime(time, ISOChronology.getInstanceUTC().withZone(DateTimeZone.UTC)); }
Example 18
Source File: BreakpointEvidence.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected BreakpointEvidence( final Kryo kryo, final Input input ) { this.location = intervalSerializer.read(kryo, input, SVInterval.class); this.weight = input.readInt(); this.validated = input.readBoolean(); }
Example 19
Source File: ObjectNodeSerializer.java From ytk-mp4j with MIT License | 4 votes |
@Override public ObjectNode read(Kryo kryo, Input input, Class<ObjectNode> type) { return new ObjectNode(input.readInt()); }
Example 20
Source File: SVInterval.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
private SVInterval( final Kryo kryo, final Input input ) { contig = input.readInt(); start = input.readInt(); end = input.readInt(); }