poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <nick.bu...@alfresco.com>
Subject Re: svn commit: r1187568 - /poi/trunk/src/java/org/apache/poi/util/LittleEndian.java
Date Sat, 22 Oct 2011 17:22:48 GMT
On Sat, 22 Oct 2011, Sergey Vladimirov wrote:
> 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.

It's more the Get case when I've found the overloaded method very useful, 
I'm less fussed about the Put overloaded case


> 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 );

I agree the former looks better than the latter here. For the get case, 
I've often found myself with just the byte array on its own (eg coming 
back from some sort of decompress or decode function), and it looks 
cleaner there to just pass that as-is to a getter without an offset

Nick

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


Mime
View raw message