-1

Hello i am looking for the design pattern of that code:

FileInputStream fin=new FileInputStream("X.zip");
BufferedInputStream bin=new BufferedInputStream(fin);
ZipInputStream zin=new ZipInputStream(bin);

i think it is a factory design pattern,what do you think guys?

Really there is no pattern,but they told me to give the name of the pattern in one word,it must be a design pattern since they asking me.

bassouat
  • 69
  • 2
  • 11
  • There's no pattern here,certainly not factory pattern. – DavidG Oct 10 '20 at 12:02
  • really,they ask me to give the corresponding design pattern name in one word so it must be a design pattern somewhere in the code – bassouat Oct 10 '20 at 12:10
  • I really hope this is not for a job interview. – Tony Stark Oct 10 '20 at 12:16
  • @TonyStark, this has been a common [interview question](https://stackoverflow.com/questions/3068912/what-is-the-most-used-pattern-in-java-io) for years. – jaco0646 Oct 10 '20 at 12:28
  • @DavidG, this is a common interview question. See the link in my comment above and also [Examples of GoF Design Patterns in Java's core libraries](https://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns-in-javas-core-libraries). – jaco0646 Oct 10 '20 at 12:30

1 Answers1

0

This is the decorator design pattern. With every new instance you are adding new behavior at runtime.

Tony Stark
  • 2,318
  • 1
  • 22
  • 41