Re: [Vala] Reading/writing a specific amount of bytes



On Tue, 2011-06-14 at 09:10 +0200, Luca Bruno wrote:
On Mon, Jun 13, 2011 at 09:04:14PM +0200, Christoph Mende wrote:
Hi,

I'm trying to read from an FileInputStream or write to an
DataOutputStream only a specific amount of bytes (4096 in this case),
both streams contain binary data. I can't find a way to do this though,
OutputStream.write() and InputStream.read() always try to read/write
everything. The only thing I found so far is a FileStream, but I have no
idea how to use FileStream.read() since it's buf parameter is not an out
parameter.
I'd really prefer using a FileInputStream for this task though, is there
any way to do this?

uint8[] data = new uint8[4096]; Then pass it to read() and it should work.


Indeed, thanks.
There's no way to do it via GIO's IOStreams though?

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]