@Override public void save(DataOutputStream out) throws IOException { out.writeInt(size); for (int i = 0; i < size; i++) { out.writeInt(data[i]); } out.writeInt(linearExpandFactor); out.writeBoolean(exponentialExpanding); out.writeDouble(exponentialExpandFactor); }
@Override protected void writeToStream(DataOutputStream output) throws IOException { output.writeUTF(uri.toString()); output.writeBoolean(isRemoveAction); output.writeInt(data.length); output.write(data); boolean customCacheKeySet = customCacheKey != null; output.writeBoolean(customCacheKeySet); if (customCacheKeySet) { output.writeUTF(customCacheKey); } }
private static void writeMethodInv(MethodInsnNode min, DataOutputStream dos) throws IOException { dos.writeUTF(min.owner); dos.writeUTF(min.name); dos.writeUTF(min.desc); dos.writeBoolean(min.itf); }
private byte[] serialize(final Map<String, String> stateValues) throws IOException { try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final DataOutputStream dos = new DataOutputStream(baos)) { dos.writeByte(ENCODING_VERSION); dos.writeInt(stateValues.size()); for (final Map.Entry<String, String> entry : stateValues.entrySet()) { final boolean hasKey = entry.getKey() != null; final boolean hasValue = entry.getValue() != null; dos.writeBoolean(hasKey); if (hasKey) { dos.writeUTF(entry.getKey()); } dos.writeBoolean(hasValue); if (hasValue) { dos.writeUTF(entry.getValue()); } } return baos.toByteArray(); } }
public RemoteSender (String ip, int port) { try { Socket socket = new Socket(ip, port); socket.setTcpNoDelay(true); socket.setSoTimeout(3000); out = new DataOutputStream(socket.getOutputStream()); out.writeBoolean(Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen)); connected = true; Gdx.input.setInputProcessor(this); } catch (Exception e) { Gdx.app.log("RemoteSender", "couldn't connect to " + ip + ":" + port); } }
File file = new File("C:/text.bin"); file.createNewFile(); DataOutputStream stream = new DataOutputStream(new FileOutputStream(file)); stream.writeBoolean(true); stream.writeInt(1234); stream.close();
private byte[] encode() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeLong(creationTime); dos.writeBoolean(server != null); if (server != null) { dos.writeUTF(server); } dos.writeBoolean(exception != null); if (exception != null) { dos.writeUTF(exception); } dos.close(); baos.close(); return baos.toByteArray(); }
@Override public final void writeToStream(DataOutputStream output) throws IOException { output.writeUTF(uri.toString()); output.writeBoolean(isRemoveAction); output.writeInt(data.length); output.write(data); output.writeInt(keys.size()); for (int i = 0; i < keys.size(); i++) { writeKey(output, keys.get(i)); } }
private static void doTestSerializationV0RoundTrip(HlsDownloadAction action) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(out); DataOutputStream dataOutputStream = new DataOutputStream(output); dataOutputStream.writeUTF(action.type); dataOutputStream.writeInt(/* version */ 0); dataOutputStream.writeUTF(action.uri.toString()); dataOutputStream.writeBoolean(action.isRemoveAction); dataOutputStream.writeInt(action.data.length); dataOutputStream.write(action.data); dataOutputStream.writeInt(action.keys.size()); for (int i = 0; i < action.keys.size(); i++) { StreamKey key = action.keys.get(i); dataOutputStream.writeInt(key.groupIndex); dataOutputStream.writeInt(key.trackIndex); } dataOutputStream.flush(); assertEqual(action, deserializeActionFromStream(out)); }
public RemoteSender (String ip, int port) { try { Socket socket = new Socket(ip, port); socket.setTcpNoDelay(true); socket.setSoTimeout(3000); out = new DataOutputStream(socket.getOutputStream()); out.writeBoolean(Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen)); connected = true; Gdx.input.setInputProcessor(this); } catch (Exception e) { Gdx.app.log("RemoteSender", "couldn't connect to " + ip + ":" + port); } }
} else if (clientVersion == 2) { // Hadoop 0.18.3 RpcCall fakeCall = new RpcCall(this, 0); DataOutputStream out = new DataOutputStream(buffer); out.writeInt(0); // call ID out.writeBoolean(true); // error WritableUtils.writeString(out, VersionMismatch.class.getName()); WritableUtils.writeString(out, errMsg);
dos.writeBoolean(useJampackInAnalysis); dos.writeBoolean(isSilentAnalysis); dos.writeInt(harmonicModel); dos.writeInt(noiseModel); dos.writeBoolean(useHarmonicAmplitudesDirectly); dos.writeFloat(regularizedCepstrumLambdaHarmonic); dos.writeBoolean(useWeightingInRegularizedCepstrumEstimationHarmonic); dos.writeInt(harmonicPartCepstrumOrderPreMel); dos.writeInt(harmonicPartCepstrumOrder); dos.writeBoolean(computeNoisePartLpOrderFromSamplingRate); dos.writeInt(noisePartLpOrder); dos.writeFloat(preemphasisCoefNoise); dos.writeBoolean(hpfBeforeNoiseAnalysis); dos.writeBoolean(decimateNoiseWaveform); dos.writeBoolean(overlapNoiseWaveformModel); dos.writeBoolean(useNoiseAmplitudesDirectly); dos.writeFloat(regularizedCepstrumEstimationLambdaNoise); dos.writeBoolean(useWeightingInRegularizedCesptrumEstimationNoise); dos.writeInt(noisePartCepstrumOderPre); dos.writeInt(noisePartCepstrumOrder); dos.writeBoolean(usePosteriorMelWarpingNoise);
private void sendString(String string) throws SAXException { try { if (string != null) { output.writeBoolean(true); output.writeUTF(string); } else { output.writeBoolean(false); } } catch (IOException e) { throw new SAXException("Unexpected fork proxy problem", e); } }
private void writeGraphName(Object graphName) throws IOException { boolean isPattern = graphName instanceof Pattern; outputStream.writeBoolean(isPattern); if (isPattern) { final Pattern pattern = (Pattern) graphName; outputStream.writeUTF(pattern.pattern()); outputStream.writeInt(pattern.flags()); } else { outputStream.writeUTF(graphName.toString()); } }
private static void doTestSerializationV0RoundTrip(SsDownloadAction action) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(out); DataOutputStream dataOutputStream = new DataOutputStream(output); dataOutputStream.writeUTF(action.type); dataOutputStream.writeInt(/* version */ 0); dataOutputStream.writeUTF(action.uri.toString()); dataOutputStream.writeBoolean(action.isRemoveAction); dataOutputStream.writeInt(action.data.length); dataOutputStream.write(action.data); dataOutputStream.writeInt(action.keys.size()); for (int i = 0; i < action.keys.size(); i++) { StreamKey key = action.keys.get(i); dataOutputStream.writeInt(key.groupIndex); dataOutputStream.writeInt(key.trackIndex); } dataOutputStream.flush(); assertEqual(action, deserializeActionFromStream(out)); }
@Override public void revalidateSession(QuorumPacket qp, LearnerHandler learnerHandler) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(qp.getData()); DataInputStream dis = new DataInputStream(bis); long id = dis.readLong(); int to = dis.readInt(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); dos.writeLong(id); boolean valid = zk.checkIfValidGlobalSession(id, to); if (valid) { try { // set the session owner as the follower that owns the session zk.setOwner(id, learnerHandler); } catch (KeeperException.SessionExpiredException e) { LOG.error("Somehow session " + Long.toHexString(id) + " expired right after being renewed! (impossible)", e); } } if (LOG.isTraceEnabled()) { ZooTrace.logTraceMessage(LOG, ZooTrace.SESSION_TRACE_MASK, "Session 0x" + Long.toHexString(id) + " is valid: "+ valid); } dos.writeBoolean(valid); qp.setData(bos.toByteArray()); learnerHandler.queuePacket(qp); }
private void writeMethod(OutputStream stream, MethodHolder method) throws IOException { DataOutputStream output = new DataOutputStream(stream); output.writeInt(symbolTable.lookup(method.getDescriptor().toString())); output.writeByte(method.getLevel().ordinal()); output.writeInt(packModifiers(method.getModifiers())); writeAnnotations(output, method.getAnnotations()); for (AnnotationContainer parameterAnnotation : method.getParameterAnnotations()) { writeAnnotations(output, parameterAnnotation); } if (method.getAnnotationDefault() != null) { output.writeBoolean(true); writeAnnotationValue(output, method.getAnnotationDefault()); } else { output.writeBoolean(false); } if (method.getProgram() != null) { output.writeBoolean(true); programIO.write(method.getProgram(), output); } else { output.writeBoolean(false); } }
dos.writeBoolean(useJampackInAnalysis); dos.writeBoolean(isSilentAnalysis); dos.writeInt(harmonicModel); dos.writeInt(noiseModel); dos.writeBoolean(useHarmonicAmplitudesDirectly); dos.writeFloat(regularizedCepstrumLambdaHarmonic); dos.writeBoolean(useWeightingInRegularizedCepstrumEstimationHarmonic); dos.writeInt(harmonicPartCepstrumOrderPreMel); dos.writeInt(harmonicPartCepstrumOrder); dos.writeBoolean(computeNoisePartLpOrderFromSamplingRate); dos.writeInt(noisePartLpOrder); dos.writeFloat(preemphasisCoefNoise); dos.writeBoolean(hpfBeforeNoiseAnalysis); dos.writeBoolean(decimateNoiseWaveform); dos.writeBoolean(overlapNoiseWaveformModel); dos.writeBoolean(useNoiseAmplitudesDirectly); dos.writeFloat(regularizedCepstrumEstimationLambdaNoise); dos.writeBoolean(useWeightingInRegularizedCesptrumEstimationNoise); dos.writeInt(noisePartCepstrumOderPre); dos.writeInt(noisePartCepstrumOrder); dos.writeBoolean(usePosteriorMelWarpingNoise);
@Override public void writeBinary(BinaryWriteContext out) throws IOException { DataOutputStream os = out.start(TYPE_TABLEIUD); os.writeUTF(table); os.writeBoolean(insert); os.writeBoolean(update); os.writeBoolean(delete); }
private void initializeData(DataOutputStream out) throws IOException { /* Write out various test values NORMALLY */ out.write(new byte[] {-100, 100}); out.writeBoolean(true); out.writeBoolean(false); out.writeByte(100); out.writeByte(-100); out.writeByte((byte) 200); out.writeChar('a'); out.writeShort((short) -30000); out.writeShort((short) 50000); out.writeInt(0xCAFEBABE); out.writeLong(0xDEADBEEFCAFEBABEL); out.writeUTF("Herby Derby"); out.writeFloat(Float.intBitsToFloat(0xCAFEBABE)); out.writeDouble(Double.longBitsToDouble(0xDEADBEEFCAFEBABEL)); }