@Override public void write(DataOutputView out) throws IOException { super.write(out); out.writeUTF(data); }
/** * This read attempts to first identify if the input view contains the special * {@link #VERSIONED_IDENTIFIER} by reading and buffering the first few bytes. * If identified to be versioned, the usual version resolution read path * in {@link VersionedIOReadableWritable#read(DataInputView)} is invoked. * Otherwise, we "reset" the input stream by pushing back the read buffered bytes * into the stream. */ public final void read(InputStream inputStream) throws IOException { byte[] tmp = new byte[VERSIONED_IDENTIFIER.length]; inputStream.read(tmp); if (Arrays.equals(tmp, VERSIONED_IDENTIFIER)) { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); super.read(inputView); read(inputView, true); } else { PushbackInputStream resetStream = new PushbackInputStream(inputStream, VERSIONED_IDENTIFIER.length); resetStream.unread(tmp); read(new DataInputViewStreamWrapper(resetStream), false); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); final Map<String, InternalTimerServiceImpl<K, ?>> registeredTimerServices = timerServicesManager.getRegisteredTimerServices(); out.writeInt(registeredTimerServices.size()); for (Map.Entry<String, InternalTimerServiceImpl<K, ?>> entry : registeredTimerServices.entrySet()) { String serviceName = entry.getKey(); InternalTimerServiceImpl<K, ?> timerService = entry.getValue(); out.writeUTF(serviceName); InternalTimersSnapshotReaderWriters .getWriterForVersion(VERSION, timerService.snapshotTimersForKeyGroup(keyGroupIdx)) .writeTimersSnapshot(out); } }
/** * This read attempts to first identify if the input view contains the special * {@link #VERSIONED_IDENTIFIER} by reading and buffering the first few bytes. * If identified to be versioned, the usual version resolution read path * in {@link VersionedIOReadableWritable#read(DataInputView)} is invoked. * Otherwise, we "reset" the input stream by pushing back the read buffered bytes * into the stream. */ public final void read(InputStream inputStream) throws IOException { byte[] tmp = new byte[VERSIONED_IDENTIFIER.length]; inputStream.read(tmp); if (Arrays.equals(tmp, VERSIONED_IDENTIFIER)) { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); super.read(inputView); read(inputView, true); } else { PushbackInputStream resetStream = new PushbackInputStream(inputStream, VERSIONED_IDENTIFIER.length); resetStream.unread(tmp); read(new DataInputViewStreamWrapper(resetStream), false); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); final Map<String, InternalTimerServiceImpl<K, ?>> registeredTimerServices = timerServicesManager.getRegisteredTimerServices(); out.writeInt(registeredTimerServices.size()); for (Map.Entry<String, InternalTimerServiceImpl<K, ?>> entry : registeredTimerServices.entrySet()) { String serviceName = entry.getKey(); InternalTimerServiceImpl<K, ?> timerService = entry.getValue(); out.writeUTF(serviceName); InternalTimersSnapshotReaderWriters .getWriterForVersion(VERSION, timerService.snapshotTimersForKeyGroup(keyGroupIdx)) .writeTimersSnapshot(out); } }
/** * This read attempts to first identify if the input view contains the special * {@link #VERSIONED_IDENTIFIER} by reading and buffering the first few bytes. * If identified to be versioned, the usual version resolution read path * in {@link VersionedIOReadableWritable#read(DataInputView)} is invoked. * Otherwise, we "reset" the input stream by pushing back the read buffered bytes * into the stream. */ public final void read(InputStream inputStream) throws IOException { byte[] tmp = new byte[VERSIONED_IDENTIFIER.length]; inputStream.read(tmp); if (Arrays.equals(tmp, VERSIONED_IDENTIFIER)) { DataInputView inputView = new DataInputViewStreamWrapper(inputStream); super.read(inputView); read(inputView, true); } else { PushbackInputStream resetStream = new PushbackInputStream(inputStream, VERSIONED_IDENTIFIER.length); resetStream.unread(tmp); read(new DataInputViewStreamWrapper(resetStream), false); } }
@Override public void write(DataOutputView out) throws IOException { super.write(out); final Map<String, InternalTimerServiceImpl<K, ?>> registeredTimerServices = timerServicesManager.getRegisteredTimerServices(); out.writeInt(registeredTimerServices.size()); for (Map.Entry<String, InternalTimerServiceImpl<K, ?>> entry : registeredTimerServices.entrySet()) { String serviceName = entry.getKey(); InternalTimerServiceImpl<K, ?> timerService = entry.getValue(); out.writeUTF(serviceName); InternalTimersSnapshotReaderWriters .getWriterForVersion(VERSION, timerService.snapshotTimersForKeyGroup(keyGroupIdx)) .writeTimersSnapshot(out); } }