Rectangle and Circle Classes: Each of these classes has a base price, and the getPrice method returns the price of the shape.
ShapeDecorator: The ShapeDecorator class calculates the total price by adding the decoration cost to the base shape price.
RedShapeDecorator: This decorator adds a cost for the red border and calls showCost to display the total price.
This way, when you call draw() on any decorated shape, it will show the cost of the decoration in addition to the basic shape cost.
Added UTF8Decorator: A new decorator class that ensures data is encoded and decoded using UTF-8 during file write and read operations.Decorator Logic:
On writeData: Converts the string to UTF-8 bytes and back to a string for consistent encoding.
On readData: Converts the read string back to UTF-8 bytes and then decodes it.
Integration: Can be added to the existing decorator chain (e.g., before EncryptionDecorator) to ensure UTF-8 compatibility.
Other Classes: No changes were made to FileDataSource, DataSourceDecorator, CompressionDecorator, or EncryptionDecorator.
This change enhances character encoding consistency in multi-layered data processing.