Java Code Examples for com.esotericsoftware.kryo.io.Output#writeString()
The following examples show how to use
com.esotericsoftware.kryo.io.Output#writeString() .
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: DoubleOperand.java From ytk-mp4j with MIT License | 6 votes |
public void write(Kryo kryo, Output output, MapMetaData<Double> object) { try { List<Map<String, Double>> mapDataList = mapMetaData.getMapDataList(); mapMetaData.send(output); int mapSegNum = mapMetaData.getSegNum(); for (int i = 0; i < mapSegNum; i++) { Map<String, Double> mapData = mapDataList.get(i); for (Map.Entry<String, Double> entry : mapData.entrySet()) { output.writeString(entry.getKey()); output.writeDouble(entry.getValue()); } if (mapMetaData.getCollective() == Collective.GATHER || mapMetaData.getCollective() == Collective.SCATTER || mapMetaData.getCollective() == Collective.REDUCE_SCATTER) { mapData.clear(); } } } catch (IOException e) { LOG.error("double array write exception", e); System.exit(1); } }
Example 2
Source File: ShortOperand.java From ytk-mp4j with MIT License | 6 votes |
public void write(Kryo kryo, Output output, MapMetaData<Short> object) { try { List<Map<String, Short>> mapDataList = mapMetaData.getMapDataList(); mapMetaData.send(output); int mapSegNum = mapMetaData.getSegNum(); for (int i = 0; i < mapSegNum; i++) { Map<String, Short> mapData = mapDataList.get(i); for (Map.Entry<String, Short> entry : mapData.entrySet()) { output.writeString(entry.getKey()); output.writeShort(entry.getValue()); } if (mapMetaData.getCollective() == Collective.GATHER || mapMetaData.getCollective() == Collective.SCATTER || mapMetaData.getCollective() == Collective.REDUCE_SCATTER) { mapData.clear(); } } } catch (IOException e) { LOG.error("double array write exception", e); System.exit(1); } }
Example 3
Source File: CacheHolderSerializer.java From RxCache with Apache License 2.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, CacheHolder object) { output.writeString(object.getData()); output.writeLong(object.getTimestamp()); output.writeLong(object.getExpireTime()); output.writeString(object.getConverterName()); }
Example 4
Source File: PSTreeNode.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void serialize(final Kryo kryo, final Output output) { final boolean oldReferences = kryo.getReferences(); kryo.setReferences(false); output.writeString(name); output.writeString(rank); output.writeInt(parent); output.writeLong(length); output.writeInt(children.size()); for (final int child : children) { output.writeString(String.valueOf(child)); } kryo.setReferences(oldReferences); }
Example 5
Source File: BreakpointComplications.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void serialize(final Kryo kryo, final Output output) { super.serialize(kryo, output); output.writeString(dupSeqRepeatUnitRefSpan.getContig()); output.writeInt(dupSeqRepeatUnitRefSpan.getStart()); output.writeInt(dupSeqRepeatUnitRefSpan.getEnd()); output.writeInt(dupSeqRepeatNumOnRef); output.writeInt(dupSeqRepeatNumOnCtg); dupSeqStrandOnRef.forEach(s -> output.writeInt(s.ordinal())); dupSeqStrandOnCtg.forEach(s -> output.writeInt(s.ordinal())); }
Example 6
Source File: KryoReadingSerializer.java From kafka-serializer-example with MIT License | 5 votes |
@Override public void write(Kryo kryo, Output output, SensorReading sensorReading) { output.writeString(sensorReading.getSensor().getId()); output.writeString(sensorReading.getSensor().getType().toString()); output.writeLong(sensorReading.getTime(), true); output.writeDouble(sensorReading.getValue()); }
Example 7
Source File: PTContainer.java From attic-apex-core with Apache License 2.0 | 5 votes |
@Override public void write(final Output out) throws KryoException { out.writeInt(container.getId()); // state out.writeInt(container.getState().ordinal()); // external id out.writeString(container.getExternalId()); // resource priority out.writeInt(container.getResourceRequestPriority()); // memory required out.writeInt(container.getRequiredMemoryMB()); // memory allocated out.writeInt(container.getAllocatedMemoryMB()); // vcores required out.writeInt(container.getRequiredVCores()); // vcores allocated out.writeInt(container.getAllocatedVCores()); // buffer server address InetSocketAddress addr = container.bufferServerAddress; if (addr != null) { out.writeString(addr.getHostName()); out.writeInt(addr.getPort()); } else { out.writeString(null); } // host out.writeString(container.host); out.writeString(container.nodeHttpAddress); out.writeInt((container.bufferServerToken == null) ? -1 : container.bufferServerToken.length); if (container.bufferServerToken != null) { out.write(container.bufferServerToken); } }
Example 8
Source File: TypeAttribute.java From datawave with Apache License 2.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, Boolean reducedResponse) { output.writeString(datawaveType.getClass().getName()); super.writeMetadata(kryo, output, reducedResponse); output.writeString(this.datawaveType.getDelegateAsString()); }
Example 9
Source File: PortNumberSerializer.java From onos with Apache License 2.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, PortNumber object) { output.writeBoolean(object.hasName()); output.writeLong(object.toLong()); if (object.hasName()) { output.writeString(object.name()); } }
Example 10
Source File: DocumentKey.java From datawave with Apache License 2.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, Boolean reducedResponse) { super.writeMetadata(kryo, output, reducedResponse); output.writeString(this.getShardId()); output.writeString(this.getDataType()); output.writeString(this.getUid()); }
Example 11
Source File: PSTaxonomyDatabase.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void serialize(final Kryo kryo, final Output output) { final boolean oldReferences = kryo.getReferences(); kryo.setReferences(false); kryo.writeObject(output, tree); output.writeInt(accessionToTaxId.size()); for (final String key : accessionToTaxId.keySet()) { output.writeString(key); output.writeString(String.valueOf(accessionToTaxId.get(key))); } kryo.setReferences(oldReferences); }
Example 12
Source File: UserSerializer.java From tutorials with MIT License | 4 votes |
@Override public void write(Kryo kryo, Output output, User user) { output.writeString(user.getEmail()); output.writeString(user.getUsername()); output.write(user.getAge()); }
Example 13
Source File: NDArrayKryoSerializer.java From attic-apex-malhar with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, NDArray ndArray) { Object dataVal = ndArray.getData(); if (dataVal == null) { return; } // NDArray throws an exception in constructor if not an array. So below value will never be null Class classNameForArrayType = dataVal.getClass().getComponentType(); // null if it is not an array int[] dimensions = ndArray.getDimensions(); boolean signedFlag = ndArray.isUnsigned(); int arraySizeInSingleDimension = 1; for (int aDimensionSize : dimensions) { arraySizeInSingleDimension = arraySizeInSingleDimension * aDimensionSize; } // write the single dimension length output.writeInt(arraySizeInSingleDimension); // write the dimension of the dimensions int array output.writeInt(dimensions.length); // next we write the dimensions array itself output.writeInts(dimensions); // next write the unsigned flag output.writeBoolean(signedFlag); // write the data type of the N-dimensional Array if (classNameForArrayType != null) { output.writeString(classNameForArrayType.getCanonicalName()); } else { output.writeString(null); } // write the array contents if (dataVal != null) { switch (classNameForArrayType.getCanonicalName()) { case "float": output.writeFloats((float[])dataVal); break; case "int": output.writeInts((int[])dataVal); break; case "double": output.writeDoubles((double[])dataVal); break; case "long": output.writeLongs((long[])dataVal); break; case "short": output.writeShorts((short[])dataVal); break; case "byte": output.writeBytes((byte[])dataVal); break; case "boolean": boolean[] originalBoolArray = (boolean[])dataVal; short[] convertedBoolArray = new short[originalBoolArray.length]; for (int i = 0; i < originalBoolArray.length; i++) { if (originalBoolArray[i]) { convertedBoolArray[i] = TRUE_AS_SHORTINT; } else { convertedBoolArray[i] = FALSE_AS_SHORTINT; } } output.writeShorts(convertedBoolArray); break; default: throw new RuntimeException("Unsupported NDArray type serialization object"); } } }
Example 14
Source File: KryoPojosForMigrationTests.java From flink with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Dog object) { output.writeString(object.getName()); }
Example 15
Source File: Content.java From datawave with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Boolean reducedResponse) { super.writeMetadata(kryo, output, reducedResponse); output.writeString(this.content); }
Example 16
Source File: KryoPojosForMigrationTests.java From flink with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Dog object) { output.writeString(object.getName()); }
Example 17
Source File: McastRoleStoreKeySerializer.java From onos with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, McastRoleStoreKey object) { kryo.writeClassAndObject(output, object.mcastIp()); output.writeString(object.deviceId().toString()); kryo.writeClassAndObject(output, object.source()); }
Example 18
Source File: KryoPojosForMigrationTests.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Dog object) { output.writeString(object.getName()); }
Example 19
Source File: PairSerializer.java From jstorm with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Pair inner) { output.writeLong(inner.getValue()); output.writeString(inner.getKey()); }
Example 20
Source File: AddressSerializer.java From atomix with Apache License 2.0 | 4 votes |
@Override public void write(Kryo kryo, Output output, Address address) { output.writeString(address.host()); output.writeInt(address.port()); }