Re: Why doesn't DataInputStream implement Seekable ?
- From: Alexander Larsson <alexl redhat com>
- To: Martin Olsson <mnemo minimum se>
- Cc: gtk-devel-list gnome org
- Subject: Re: Why doesn't DataInputStream implement Seekable ?
- Date: Tue, 09 Dec 2008 09:11:18 +0100
On Mon, 2008-12-08 at 22:37 +0100, Martin Olsson wrote:
> Hi,
>
> I'm wondering if there was any particular design rationale behind GLib not
> implementing the Seekable interface on the class DataInputStream?
>
> If there is no particular reason, then I would like to file a feature request
> to get Seekable into DataInputStream or one of it's base classes.
>
> I'm parsing a big file and I would like to seek to one specific location,
> read some data and then seek to a second location and read some data from
> there as well. As a workaround I tried to seek on the underlying FileInputStream
> that I passed as a parameter to the DataInputStream constructor but this
> hack didn't work reliably.
The reason that is not reliable is that GDataInputStream inherits from
GBufferedInputStream, and the buffer it has causes issues with the seek.
However, i don't think there is an inherent problem with implementing
seek in GBufferedInputStream (if the underlying stream supports it).
Would be a nice addition.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]