Changes in interface RandomAccessContent.
-----------------------------------------

                 Key: VFS-99
                 URL: http://issues.apache.org/jira/browse/VFS-99
             Project: Commons VFS
          Issue Type: Wish
            Reporter: Elifarley Callado Coelho


I think the interface RandomAccessContent should not extend DataOutput nor 
DataInput;
Instead, it could declare the following new methods:

1)   int read(byte b[], int off, int len) throws IOException;
2)   void write(byte b[], int off, int len) throws IOException;
    
3)   int pread(long pos, byte b[], int off, int len) throws IOException;
4)   void pwrite(long pos, byte b[], int off, int len) throws IOException;

Instead of changing this interface, a new one could be created 
(RandomAccessStream, maybe).

Benefits:
Currently, if a class implements this interface, it has to implement method 
"skipBytes", which is redundant since it already implements method "seek".

It also has to implement 14 methods related to reading, which is also redundant 
since they can be expressed in terms of specific calls to more primitive 
methods such as those proposed above.

In other words, I don't think different classes implementing 
RandomAccessContent (or RandomAccessStream) should all implement methods 
"readShort", "readInt"", "readLong", etc, since all implementations of them 
will be the same, if they are expressed in terms of calls to read(byte b[], int 
off, int len).



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to