commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Ivankovits (JIRA)" <j...@apache.org>
Subject [jira] Commented: (VFS-99) Changes in interface RandomAccessContent.
Date Sat, 09 Dec 2006 08:16:22 GMT
    [ http://issues.apache.org/jira/browse/VFS-99?page=comments#action_12457049 ] 
            
Mario Ivankovits commented on VFS-99:
-------------------------------------

Instead of changing the interface I decided to provide a new base class for all stream based
random access content implementations (AbstractRandomAccessContent), that way you no longer
have to implement those methods.

In case of LocalFile and SMB it is wanted to delegate those methods to their "native" counterparts.
We dont know if they use a more performant implementation (e.g. by using native code)

However, thanks for pointing it out!

> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message