mercredi 31 août 2016

Which design pattern would suite for the scenario?

My Objective is to read/write files either to local directory or on remote machine and my code contains the following components

  1. A wrapper class which contains add file and get file methods as follows
    • public static String[] addFile(params) - this returns an extended ouput stream (say ABCOuputStream) - with which we can write the data
    • public static String[] addFile(byte[] filecontent) - this method writes the file content directly to local or remote machine
    • public static byte[] getFile() - this method reads the content from local/remote machine - and it returns the file content as byte array
    • public static InputStream getFile() - this method returns an extended input stream(say ABCInputStream) - and the data would be read from this stream

2.ABCInputStream class - which is an extended input stream

3.ABCOutputStream class - which is an extended output stream

I am not convinced with the wrapper class structure which does all these things.

Sorry for too long theoretical description. I'm ready to add further details if needed.

Some one please help me to choose a pattern to improve this in a much better way.

Aucun commentaire:

Enregistrer un commentaire