SlideServe
Menu
Préférences
© SlideServe · v2026

The Decorator Pattern Decorators in Java I/O classes

pascha avatar
9 diapositives · 258 Views · Aug 04, 2014

The Decorator Pattern Decorators in Java I/O classes. Decorator Pattern context. You want to attach additional functionality to an (existing) class dynamically… …without having to resort to sub-classing the existing class We don’t want a class explosion

The Decorator Pattern Decorators in Java I/O classes - slide 1
01 / 9The Decorator Pattern Decorators in Java I/O classes
1 / 17

Télécharger la présentation

The Decorator Pattern Decorators in Java I/O classes
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. The Decorator PatternDecorators in Java I/O classes SE-2811 Dr. Mark L. Hornick

  2. Decorator Pattern context • You want to attach additional functionality to an (existing) class dynamically… • …without having to resort to sub-classing the existing class • We don’t want a class explosion • We want to allow classes to be easily “extended” to incorporate new behavior without modifying existing code.

  3. + doMoreStuff() SE-2811 Dr. Mark L. Hornick

  4. How are decorators useful? • Decorators have the same super-type as the objects they decorate. • Why is this useful? • One or more decorators can be used to wrap an object. • Why is this useful?

  5. The java.io package contains dozens of classes OutputStream, FileOutputStream, PipedOutputStream, DataOutputStream, ObjectOutputStream, PrintStream, PrintWriter, … Understanding the associations between them just by reading the Javadoc API is difficult SE-2811 Dr. Mark L. Hornick

  6. Knowing that the input stream classes are based on the Decorator pattern can make things easier <<deprecated>> SE-2811 Dr. Mark L. Hornick

  7. The Decorator pattern applied to output streams Only for error propagation in my Java version SE-2811 Dr. Mark L. Hornick

  8. You can create custom stream decorators by extending FilterOutputStream and FilterInputStream • Exercise SE-2811 Dr. Mark L. Hornick

  9. Comparison of Decorator with Strategy SE-2811 Dr. Mark L. Hornick