1

Closed

large Byte[] storage

description

Knowing my ability to miss the obvious, I thought I would ask before doing a wrapper to span and compress a large byte array. When I tried this:
    [Span(compress:true)]
   public Byte[] Binary { get; set; }
it put something into SimpleDB that looked gzipped as expected (I looked using SimpleDB ScratchPad), but it was fatally unhappy when it came time to read it back in. Is this a situation where I should convert the byte array to Base64 and store it in a spanned string? Thanks!
Closed Nov 2, 2011 at 1:11 PM by ashleytate
A custom formatter is required for serializing arrays. The Simol.Formatters.ByteArrayFormatter is a custom formatter provided for use with byte arrays.See this page for a usage example: http://simol.codeplex.com/wikipage?title=Defining%20Object%20Mappings

comments

tim124 wrote Nov 2, 2011 at 9:35 AM

It would be a better idea to make your wrapper save the byte[] data to Amazons S3 storage. Save a ID string in place of your Binary property and then save the data to S3 using the ID as the key.

wrote Nov 2, 2011 at 1:11 PM

bdm wrote Nov 2, 2011 at 3:43 PM

I actually read that and tried that first, and I should have mentioned it. It (still) gives me "The type or namespace ByteArrayFormatter could not be found..." even though I'm "using" Simol and everything else works fine. Any clues? Thanks!
    [Span(compress:true)]
    [CustomFormat(typeof(ByteArrayFormatter))]
    public Byte[] Binary { get; set; }

ashleytate wrote Nov 2, 2011 at 4:22 PM

@bdm: Please make sure you're using the latest release and also "using" Simol.Formatters" since the formatter class is not in the root namespace.

bdm wrote Nov 2, 2011 at 5:30 PM

Ah! I didn't know about that namespace, but I'm sure it's somewhere in the documentation. Thanks!

wrote Feb 13, 2013 at 10:44 PM

wrote May 16, 2013 at 5:33 AM