poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Vladimirov <vlser...@gmail.com>
Subject Re: svn commit: r1187568 - /poi/trunk/src/java/org/apache/poi/util/LittleEndian.java
Date Sat, 22 Oct 2011 17:18:56 GMT
On Sat, Oct 22, 2011 at 9:01 PM, Nick Burch <nick.burch@alfresco.com> wrote:
> On Fri, 21 Oct 2011, sergey@apache.org wrote:
>> URL: http://svn.apache.org/viewvc?rev=1187568&view=rev
>> Log:
>> it's better to always specify offset for write and reading operations
>> deprecate methods with default (0) offset
> I'm not sure I see the point of deprecating these helper methods? I think
> they're handy at times, and I don't see the harm of having them there to
> make people's lives easier and their code simpler?
If the only thing that user doing is to "wrap" some single value in
byte[] array, it seems he's doing something non optimal. Either it
should be part of bigger array, or adding to array shall be replaced
with writing to OutputStream.

And if this is a case when we adding first element to array at the
beginning, and continue later, than code like

LittleEndian.putInt( array, 0, value1 );
LittleEndian.putInt( array, 4, value1 );
LittleEndian.putInt( array, 8, value1 );

is better than

LittleEndian.putInt( array, value1 );
LittleEndian.putInt( array, 4, value1 );
LittleEndian.putInt( array, 8, value1 );

because no questions occure what's going on in the first line.

Another though - there are a lot of methods in LittleEndian already.
And I don't like the idead of duplicating putSomething ( array,
offset, value ) with putSomething ( array, value ) for every

Not sure if worth to mention case when user selecting wrong method and
forgot to set offset at all.

Sergey Vladimirov

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message