Adapter

  • 12
  • Locked
Use the AdapterFileOutputStream class to adapt FileOutputStream to the new AmigoStringWriter interface.
You can't complete this task, because you're not signed in.
Comments (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Karas Java Developer
29 July 2021, 00:02
Just as a big hint, the write method will not accept a string as a parametter, use .getBytes() on the string. Hope it helps.
Henrique
Level 41 , São Paulo, Brazil
29 June 2020, 14:07
What does "delegate the call" to something mean?
Andrei
Level 41
3 February 2021, 08:48
It means you use the call on an object that already has that method available and ready to be implemented. meaning you don't have to write the method behavior yourself. In this case, we have created a FileOutputStream object and as we know, FileOutputStream as an interface has methods such as flush, close and write. So to delegate the call means to take the FileOutputStream constructor parameter, call on it the respective method and add it to the body of the method you need. For example, in the flush() method of the AdapterFIleOutputStream class you will delegate as follows: FileOutputStream variable , dot operator , the method you need to call. Similar to wrapper pattern. I can't really write more detailed because that would mean giving away part of the solution. Anyway, hope it makes sense!
Guadalupe Gagnon
Level 37 , Tampa, United States
11 November 2019, 15:49
If you passed you passed. A lot of these tasks are just introducing you to programming concepts and the things that can be done. A full and deep understanding of each is not going to happen until you have a chance to put theory into practice. At this point it makes more sense to just touch upon certain subjects then to delve deeply into them where you are going to get bogged down.
Andrei
Level 41
3 February 2021, 08:49
Nice reminder, thank you!