Class OutputStreamObjectDataWriter<T>

    • Constructor Detail

      • OutputStreamObjectDataWriter

        public OutputStreamObjectDataWriter​(OutputDataSource dataSource,
                                            OutputStreamOutputConverter<T> converter)
        Construct an instance that will use the specified data source to write the object to that is converted with the specified converter. The OutputStream of the OutputDataSource will be set on the Converter before calling its write method.
        Parameters:
        dataSource - the data source where the converted object will be written to
        converter - the converter that is used for converting the object to be written
    • Method Detail

      • newGluonObservableObject

        public GluonObservableObject<T> newGluonObservableObject()
        Description copied from interface: ObjectDataWriter
        Provide an instance of a GluonObservableObject. This method is called by DataProvider.storeObject(Object, ObjectDataWriter) to get a GluonObservableObject that will contain the actual object when the store operation has completed successfully. Most implementations will just return an instance of GluonObservableObject itself. Note that it is perfectly valid to return existing instances of GluonObservableObject.
        Specified by:
        newGluonObservableObject in interface ObjectDataWriter<T>
        Returns:
        an instance of a GluonObservableObject
      • writeObject

        public Optional<T> writeObject​(T object)
                                throws IOException
        Writes the object to the specified data source and returns an Optional that contains the exact same object instance that was passed in. This implementation uses the specified converter to convert the provided object. The OutputStream of the specified data source will be set on the converter, before calling the write method on the converter.
        Specified by:
        writeObject in interface ObjectDataWriter<T>
        Parameters:
        object - the object to write
        Returns:
        the object that will ultimately be set on the GluonObservableObject
        Throws:
        IOException - when an exception occurred during the write process