Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #863 (closed task: wontfix)

Opened 16 years ago

Last modified 16 years ago

Conduit and Buffer seeking seems lacking

Reported by: Chris Miller Assigned to: kris
Priority: major Milestone: 1.0
Component: Examples Version: 0.99.4 Frank
Keywords: stream, conduit, buffer, seek, triage Cc:

Description

I need a simple reference to any type of "streamable" object that must support both reading and seeking, and it doesn't matter if it supports anything else. I don't care if the data is buffered or unbuffered, on disk or all in memory, or even in a parallel dimension, I just care if it supports read and seek.

interface IConduit.Seek seems not implemented by many classes, so far I've only seen FileConduit? implement it (though there may be more). This rules out any other storage type. I don't want the user to have to reimplement stuff just to get this to work on something that should already support seeking, like a simple array in memory (wrapped in a type of stream).

Phobos' Stream class "just works"; whether or not the stream supports other stuff, as long as reading and seeking works on the Stream, I can work with it. Phobos' Stream will throw an exception if something isn't supported, but it also has boolean flags that indicate if "seekable", etc.

Change History

01/22/08 01:51:55 changed by kris

  • owner changed from sean to kris.

01/22/08 01:58:18 changed by kris

In the interim you might do this -- test stream.conduit for IConduit.Seek and use it directly if so (via seek/read methods)

02/11/08 01:13:19 changed by kris

  • milestone changed from 0.99.5 to 0.99.6.

Did that work for ya, Chris, or did you wind up using DataStream? instead?

02/15/08 00:02:03 changed by WasserDragoon

  • component changed from Core Functionality to Examples.
  • type changed from enhancement to task.

I dont understand how to use DataStream? :-( Can you give any example?

02/15/08 17:51:31 changed by WasserDragoon

Now I think it´s DFL, that it doesnt work... My Code: http://paste.dprogramming.com/dpbguerh DDbg Output: http://paste.dprogramming.com/dpdopwxd Can you take a look at it, Chris? Thanks.

02/15/08 18:46:38 changed by Chris Miller

Kris, I was already doing this; I test if the conduit supports Seek (by casting to the interface) and use it. But Buffer does not support it. I don't see how DataStream? is useful, it doesn't support Seek that I can see. WasserDragoon?, this also applies to you; your conduit has to be seekable.

02/15/08 19:04:48 changed by kris

02/15/08 19:22:02 changed by WasserDragoon

kris, on my example: i would like to import an image to set picturebox' image with its content...how i should import it with DataFileStream??

02/15/08 19:42:43 changed by WasserDragoon

i think i got it partiatly...but i get an alert...see http://paste.dprogramming.com/dptgto1q

02/15/08 22:25:15 changed by kris

Sorry, wasserDragon, but that is trying to set the image content as a file-name instead :)

Instead, wrap a Buffer instance around the content, which gives you an InputStream?:

auto input = new Buffer (image);

04/18/08 03:53:12 changed by kris

  • milestone changed from 0.99.6 to 1.0.

04/27/08 18:32:00 changed by Keyframe

I tried to read image from a zip file in order to use it in DFL for PictureBox? also.

Here is the code: http://paste.dprogramming.com/dpehui32

I have tried to Buffer it, but it throws an assertion failure.

However, my first try was to use splash_image itself (which is an InpuStream?), it throws "Unable to load picture from stream". Chris suggested this is the same issue mentioned here, so here is my voice to it.

Current workaround is not pretty, I extract and copy image from the zip to a local directory and read it from there.

04/28/08 03:50:42 changed by kris

you might find InputStream?.load() to be useful ... it loads the stream into an array

05/24/08 18:21:09 changed by larsivi

  • keywords changed from stream, conduit, buffer, seek to stream, conduit, buffer, seek, triage.

Also see this thread

10/05/08 05:58:57 changed by kris

  • status changed from new to closed.
  • resolution set to wontfix.

I recall this was resolved -- closing since there's no further commentary. Reopen as necessary