You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Rajath Shashidhara <ra...@gmail.com> on 2013/06/18 16:20:17 UTC

XInputStream

Hello,

The methods readBytes and readSomeBytes have an argument Byte[][] .

But shouldn't it be Byte[] ? because java.io.InputStream reads to a byte[]?
What is the point of having a byte [][]?

This example also suggests this:
http://forum.openoffice.org/en/forum/viewtopic.php?t=3801

They copy the ans to buffer[0] in buffer[][].

-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: XInputStream

Posted by Jürgen Schmidt <jo...@gmail.com>.
On 6/18/13 5:04 PM, Rajath Shashidhara wrote:
> Hello,
> 
> Also in the file XInputStream implementation,
> readSomeBytes() implementation just calls readBytes() method.
> Code:
> 
> sal_Int32 SAL_CALL
> XInputStream_impl::readSomeBytes(
>     uno::Sequence< sal_Int8 >& aData,
>     sal_Int32 nMaxBytesToRead )
>     throw( io::NotConnectedException,
>            io::BufferSizeExceededException,
>            io::IOException,
>            uno::RuntimeException)
> {
>     return readBytes( aData,nMaxBytesToRead );
> }
> 
> 
> But this behaviour is not like the one described in
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/io/XInputStream.html#readBytes
> .
> 
> Should I also do the same?

the IDL definition says it is an "out" parameter and "out" parameters
are mapped in Java to arrays of length 1. The caller of this method is
responsible for this parameter.

In C++ it's a reference parameter that is already created/initialized
and that can be changed or better filled in the method.

Juergen


> 
> 
> 
> On Tue, Jun 18, 2013 at 7:50 PM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
> 
>> Hello,
>>
>> The methods readBytes and readSomeBytes have an argument Byte[][] .
>>
>> But shouldn't it be Byte[] ? because java.io.InputStream reads to a byte[]?
>> What is the point of having a byte [][]?
>>
>> This example also suggests this:
>> http://forum.openoffice.org/en/forum/viewtopic.php?t=3801
>>
>> They copy the ans to buffer[0] in buffer[][].
>>
>> --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
> 
> 
> 


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


Re: XInputStream

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

Also in the file XInputStream implementation,
readSomeBytes() implementation just calls readBytes() method.
Code:

sal_Int32 SAL_CALL
XInputStream_impl::readSomeBytes(
    uno::Sequence< sal_Int8 >& aData,
    sal_Int32 nMaxBytesToRead )
    throw( io::NotConnectedException,
           io::BufferSizeExceededException,
           io::IOException,
           uno::RuntimeException)
{
    return readBytes( aData,nMaxBytesToRead );
}


But this behaviour is not like the one described in
http://www.openoffice.org/api/docs/common/ref/com/sun/star/io/XInputStream.html#readBytes
.

Should I also do the same?



On Tue, Jun 18, 2013 at 7:50 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
>
> The methods readBytes and readSomeBytes have an argument Byte[][] .
>
> But shouldn't it be Byte[] ? because java.io.InputStream reads to a byte[]?
> What is the point of having a byte [][]?
>
> This example also suggests this:
> http://forum.openoffice.org/en/forum/viewtopic.php?t=3801
>
> They copy the ans to buffer[0] in buffer[][].
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani