You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by cafe <rm...@estudiantes.uci.cu> on 2007/01/30 02:44:10 UTC
Possible bug in activeMQ4.1.0 with Streams?
I have a simple program that sends a stream to a queue,
…
OutputStream out = connection.createOutputStream(destination);
File file = new File("D:/file.xml");
FileInputStream fis = new FileInputStream(file);
int l;
byte[] array = new byte[1024];
while ( (l = fis.read(array)) != -1 ){
out.write(array);
}
And in the other side a simple program who receive the stream:
InputStream fis = connection.createInputStream(destination);
FileOutputStream out = new FileOutputStream("D:/Newfile.xml");
int l;
byte[] array= new byte[1024];
while ((l = fis.read(array)) > 0) {
out.write(array);
}
The problem is that activeMQ is putting more bytes to the stream, for
example I have run these programs with the following input (file.xml):
1
2
3
4
5
6
7
8
9
And I obtain the following file (NewFile.xml)
1
2
3
4
5
6
7
8
9
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
note: the line above are the byte added by activeMQ
What could be this?
--
View this message in context: http://www.nabble.com/Possible-bug-in-activeMQ4.1.0-with-Streams--tf3139553.html#a8702029
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Possible bug in activeMQ4.1.0 with Streams?
Posted by cafe <rm...@estudiantes.uci.cu>.
ok Christopher I saw my error, thx
cafe wrote:
>
> could you be more specific, I have proved the example below and work good:
>
> FileInputStream fis = new FileInputStream("D:/listaBig.xml");
> FileOutputStream out = new FileOutputStream("D:/NewLista.xml");
>
> int leidos, total = 0;
> byte[] array= new byte[1024];
>
> while ((leidos = fis.read()) != -1) {
> out.write(leidos);
> total += leidos;
> }
> System.out.println(total);
> }
>
>
>
>
> Christopher G. Stach II wrote:
>>
>> cafe wrote:
>>> I have a simple program that sends a stream to a queue,
>>>
>>> …
>>> OutputStream out = connection.createOutputStream(destination);
>>>
>>> File file = new File("D:/file.xml");
>>>
>>> FileInputStream fis = new FileInputStream(file);
>>>
>>> int l;
>>> byte[] array = new byte[1024];
>>>
>>> while ( (l = fis.read(array)) != -1 ){
>>> out.write(array);
>>>
>>> }
>>>
>>>
>>>
>>> And in the other side a simple program who receive the stream:
>>>
>>> InputStream fis = connection.createInputStream(destination);
>>> FileOutputStream out = new FileOutputStream("D:/Newfile.xml");
>>>
>>> int l;
>>> byte[] array= new byte[1024];
>>>
>>> while ((l = fis.read(array)) > 0) {
>>> out.write(array);
>>> }
>>>
>>>
>>> The problem is that activeMQ is putting more bytes to the stream, for
>>> example I have run these programs with the following input (file.xml):
>>> 1
>>> 2
>>> 3
>>> 4
>>> 5
>>> 6
>>> 7
>>> 8
>>> 9
>>>
>>> And I obtain the following file (NewFile.xml)
>>> 1
>>> 2
>>> 3
>>> 4
>>> 5
>>> 6
>>> 7
>>> 8
>>> 9
>>> ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
>> _______
>>>
>>> note: the line above are the byte added by activeMQ
>>>
>>> What could be this?
>>>
>>>
>>
>> You're using the wrong ``write'' method.
>>
>> --
>> Christopher G. Stach II
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Why-activeMQ-put-extra-bytes-when-I-send-a-stream--tf3139553.html#a8703927
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Possible bug in activeMQ4.1.0 with Streams?
Posted by cafe <rm...@estudiantes.uci.cu>.
could you be more specific, I have proved the example below and work good:
FileInputStream fis = new FileInputStream("D:/listaBig.xml");
FileOutputStream out = new FileOutputStream("D:/NewLista.xml");
int leidos, total = 0;
byte[] array= new byte[1024];
while ((leidos = fis.read()) != -1) {
out.write(leidos);
total += leidos;
}
System.out.println(total);
}
Christopher G. Stach II wrote:
>
> cafe wrote:
>> I have a simple program that sends a stream to a queue,
>>
>> …
>> OutputStream out = connection.createOutputStream(destination);
>>
>> File file = new File("D:/file.xml");
>>
>> FileInputStream fis = new FileInputStream(file);
>>
>> int l;
>> byte[] array = new byte[1024];
>>
>> while ( (l = fis.read(array)) != -1 ){
>> out.write(array);
>>
>> }
>>
>>
>>
>> And in the other side a simple program who receive the stream:
>>
>> InputStream fis = connection.createInputStream(destination);
>> FileOutputStream out = new FileOutputStream("D:/Newfile.xml");
>>
>> int l;
>> byte[] array= new byte[1024];
>>
>> while ((l = fis.read(array)) > 0) {
>> out.write(array);
>> }
>>
>>
>> The problem is that activeMQ is putting more bytes to the stream, for
>> example I have run these programs with the following input (file.xml):
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>>
>> And I obtain the following file (NewFile.xml)
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>> ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
> _______
>>
>> note: the line above are the byte added by activeMQ
>>
>> What could be this?
>>
>>
>
> You're using the wrong ``write'' method.
>
> --
> Christopher G. Stach II
>
>
>
--
View this message in context: http://www.nabble.com/Why-activeMQ-put-extra-bytes-when-I-send-a-stream--tf3139553.html#a8702781
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Possible bug in activeMQ4.1.0 with Streams?
Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
cafe wrote:
> I have a simple program that sends a stream to a queue,
>
> …
> OutputStream out = connection.createOutputStream(destination);
>
> File file = new File("D:/file.xml");
>
> FileInputStream fis = new FileInputStream(file);
>
> int l;
> byte[] array = new byte[1024];
>
> while ( (l = fis.read(array)) != -1 ){
> out.write(array);
>
> }
>
>
>
> And in the other side a simple program who receive the stream:
>
> InputStream fis = connection.createInputStream(destination);
> FileOutputStream out = new FileOutputStream("D:/Newfile.xml");
>
> int l;
> byte[] array= new byte[1024];
>
> while ((l = fis.read(array)) > 0) {
> out.write(array);
> }
>
>
> The problem is that activeMQ is putting more bytes to the stream, for
> example I have run these programs with the following input (file.xml):
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
>
> And I obtain the following file (NewFile.xml)
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
_______
>
> note: the line above are the byte added by activeMQ
>
> What could be this?
>
>
You're using the wrong ``write'' method.
--
Christopher G. Stach II