Understanding bridge pattern and Java streams -


i'm reading gof design patterns , trying undersand bridge pattern. now, consider java streams (official documentation).

they introduced 2 kind of streams: node streams , filter streams. latter uses node streams perform actual writing to/ reading stream. node streams incapsulate low-level io details. in sense of gof bridge pattern, can node streams considered bridge (implementor) used filter streams?

if so, practice not create separate interface bridge. example:

public interface datawriter{      public void write(object); } 

in case, there might 2 kind of implementatios: 1 defines low-level io details, , 1 performs convertions, validation, etc. , uses underlying datawriter write data (to file system persistance store, java outputstream, etc.). can consider first 1 bridge , write javadoc interface in order avoid creating datawriterimplementor interface?


Comments