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.