Override the Serializable method.

@param stream
@throws IOException
@throws ClassNotFoundException
7099
@SuppressWarnings("unchecked")
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        stream.defaultReadObject();
        this.properties = (Map<Object, Object>) stream.readObject();
    }
377778
private void writeObject(ObjectOutputStream stream) throws IOException{
        if (defaultCenturyStart == null) {
            // if defaultCenturyStart is not yet initialized,
            // calculate and set value before serialization.
            initializeDefaultCenturyStart(defaultCenturyBase);
        }
        initializeTimeZoneFormat(false);
        stream.defaultWriteObject();
        stream.writeInt(getContext(DisplayContext.Type.CAPITALIZATION).value());
    }
1316240
@Override
  public StreamImpl stream()
    throws IOException
  {
    if (_stream == null) {
      _stream = new JniStream(this);
    }

    _stream.init();

    return _stream;
  }
1311579
public void setStreamSource(InstanceStream stream) {
		this.streamSource = new StreamSource(stream);
		firstInstance = streamSource.nextInstance().getData();
	}
932043
public static void copy(final InputStream inputStream, final OutputStream outputStream)
      throws IOException {
    new ByteSource() {
      @Override
      public InputStream openStream() {
        return inputStream;
      }
    }.copyTo(new ByteSink() {
      @Override
      public OutputStream openStream() {
        return outputStream;
      }
    });
  }
272593
private void readObject(ObjectInputStream stream) throws IOException {
        try {
            decode(stream);
        } catch (InvalidKeyException e) {
            e.printStackTrace();
            throw new IOException("deserialized key is invalid: " +
                                  e.getMessage());
        }
    }
293498
private void writeObject(ObjectOutputStream stream) throws IOException {
		final Object[] lList = this.listeners;
		stream.defaultWriteObject();

		// Save the non-null event listeners:
		for (int i = 0; i < lList.length; i += 2) {
			final Class<?> t = (Class<?>) lList[i];
			final EventListener l = (EventListener) lList[i + 1];
			if ((l != null) && (l instanceof Serializable)) {
				stream.writeObject(t.getName());
				stream.writeObject(l);
			}
		}

		stream.writeObject(null);
	}
780027
public static void serialize(Object value, OutputStream outputStream) throws IOException {
    try {
      new ObjectOutputStream(outputStream).writeObject(value);
    } finally {
      outputStream.close();
    }
  }
1356330
public static void save(Object o, OutputStream stream) {
        try {
            ObjectOutputStream outStream = 
                (stream instanceof ObjectOutputStream)
                    ? (ObjectOutputStream)stream
                    : new ObjectOutputStream(stream);
            outStream.writeObject(o);
        } catch (IOException ioe) {
            throw new IOError(ioe);
        }
    }
1060943
private void copyToStream(String txt, OutputStream stream) throws IOException {
        if (txt != null) {
            stream.write(txt.getBytes());
        }
    }
163811
@Override
    protected void processClass (File source, Class<?> sclass)
        throws IOException
    {
        StreamableClassRequirements reqs = new StreamableClassRequirements(sclass);
        // we must implement Streamable, not be a DObject and have some fields that need to be
        // streamed
        if (!Streamable.class.isAssignableFrom(sclass) || DObject.class.isAssignableFrom(sclass) ||
                reqs.streamedFields.isEmpty()) {
            // System.err.println("Skipping " + sclass.getName() + "...");
            return;
        }

        // add readObject() and writeObject() definitions
        StringBuilder readbuf = new StringBuilder(READ_OPEN);
        StringBuilder writebuf = new StringBuilder(WRITE_OPEN);

        if (reqs.superclassStreamable) {
            readbuf.append("        super.readObject(ins);\n");
            writebuf.append("        super.writeObject(out);\n");
        }
        for (Field field : reqs.streamedFields) {
            readbuf.append("        ");
            readbuf.append(field.getName()).append(" = ");
            readbuf.append(toReadObject(field));
            readbuf.append(";\n");

            writebuf.append("        out.");
            writebuf.append(toWriteObject(field));
            writebuf.append(";\n");
        }

        readbuf.append(READ_CLOSE);
        writebuf.append(WRITE_CLOSE);

        SourceFile sfile = new SourceFile();
        try {
            sfile.readFrom(source);
        } catch (IOException ioe) {
            System.err.println("Error reading " + source + ": " + ioe);
        }

        // don't overwrite an existing readObject() or writeObject()
        StringBuilder methods = new StringBuilder();
        if (!sfile.containsString("public void readObject")) {
            methods.append(readbuf);
        }
        if (!sfile.containsString("public void writeObject")) {
            if (methods.length() > 0) {
                methods.append("\n");
            }
            methods.append(writebuf);
        }
        if (methods.length() == 0) {
            return; // nothing to do
        }

        System.err.println("Converting " + sclass.getName() + "...");

        writeFile(source.getAbsolutePath(), sfile.generate(null, methods.toString()));
    }
859593
public static int serialize(OutputStream stream, Object obj) {
        ObjectMapper mapper = createMapperWithJaxbAnnotationInspector();

        try (DataOutputStream data = new DataOutputStream(stream);
             OutputStreamWriter writer = new OutputStreamWriter(data, StandardCharsets.UTF_8)) {
            mapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);
            return data.size();
        } catch (IOException e) {
            throw new ReportGenerationException(e);
        }
    }
991395
private void readObject(ObjectInputStream stream)
        throws IOException, ClassNotFoundException {
        stream.defaultReadObject();
        int capitalizationSettingValue = (serialVersionOnStream > 1)? stream.readInt(): -1;
        ///CLOVER:OFF
        // don't have old serial data to test with
        if (serialVersionOnStream < 1) {
            // didn't have defaultCenturyStart field
            defaultCenturyBase = System.currentTimeMillis();
        }
        ///CLOVER:ON
        else {
            // fill in dependent transient field
            parseAmbiguousDatesAsAfter(defaultCenturyStart);
        }
        serialVersionOnStream = currentSerialVersion;
        locale = getLocale(ULocale.VALID_LOCALE);
        if (locale == null) {
            // ICU4J 3.6 or older versions did not have UFormat locales
            // in the serialized data. This is just for preventing the
            // worst case scenario...
            locale = ULocale.getDefault(Category.FORMAT);
        }

        initLocalZeroPaddingNumberFormat();

        setContext(DisplayContext.CAPITALIZATION_NONE);
        if (capitalizationSettingValue >= 0) {
            for (DisplayContext context: DisplayContext.values()) {
                if (context.value() == capitalizationSettingValue) {
                    setContext(context);
                    break;
                }
            }
        }

        // if serialized pre-56 update & turned off partial match switch to new enum value
        if(getBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH) == false) {
            setBooleanAttribute(DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH, false);
        }

        parsePattern();
    }
1191535
protected void doReadObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
        final GetField readFields = stream.readFields();

        for (final String fieldName : getFieldNamesInAdditionToId()) {
            final Object value = readFields.get(fieldName, null);
            setField(fieldName, value);
        }

        // fix issue of deserializing _rowNumber in it's previous int form
        final long rowNumber;
        final ObjectStreamField legacyRowNumberField =
                readFields.getObjectStreamClass().getField(getFieldNameForOldId());
        if (legacyRowNumberField != null) {
            rowNumber = readFields.get(getFieldNameForOldId(), -1);
        } else {
            rowNumber = readFields.get(getFieldNameForNewId(), -1L);
        }

        setField(getFieldNameForNewId(), rowNumber);
    }
566737
@SneakyThrows
    public static void serialize(final Serializable object, final OutputStream outputStream) {
        try (val out = new ObjectOutputStream(outputStream)) {
            out.writeObject(object);
        }
    }
318048
public void save(Writer stream) throws IOException {
        final PrintWriter out = new PrintWriter(new BufferedWriter(stream));
        try {
            out.println("<?xml version='1.0' encoding='UTF-8'?>");
            toStringRep("", new HashMap<String, String>(), new XNAppender() {
                @Override
                public XNAppender append(Object o) {
                    out.print(o);
                    return this;
                }
                @Override
                public int length() {
                    return 0; // Not used here
                }
            }, null);
        } finally {
            out.flush();
        }
    }
761076
private void writeObject(ObjectOutputStream outStream) throws IOException {
        if (classLoaderToPropagate == SYSTEM_CLASS_LOADER)
            classLoaderIdentifier = "";
        else if (classLoaderToPropagate != null) {
            classLoaderIdentifier = classLoaderContextProvider.getClassLoaderIdentifier(classLoaderToPropagate);
            if (classLoaderIdentifier == null)
                throw new NotSerializableException(classLoaderToPropagate.getClass().getName());
        }
        PutField fields = outStream.putFields();
        fields.put(CLASS_LOADER_IDENTIFIER, classLoaderIdentifier);
        outStream.writeFields();
    }