// This software code is made available "AS IS" without warranties of any
// kind. You may copy, display, modify and redistribute the software
// code either by itself or as incorporated into your code; provided that
// you do not remove any proprietary notices. Your use of this software
// code is at your own risk and you waive any claim against Amazon
// Digital Services, Inc. or its affiliates with respect to your use of
// this software code. (c) 2006 Amazon Digital Services, Inc. or its
// affiliates.
using System;
using System.Collections;
using System.Text;
namespace Extf.Net.S3
{
public class S3Object
{
private byte [] bytes;
///
/// Acquires the binary representation of an object.
///
public byte [] Bytes {
get {
return bytes;
}
}
///
/// Acquires the ASCII Encoding representation of an object.
///
public string Data {
get {
ASCIIEncoding encoder = new ASCIIEncoding();
return encoder.GetString(bytes, 0, bytes.Length);
}
}
private SortedList metadata;
///
/// Acquires the metadata.
///
public SortedList Metadata {
get {
return metadata;
}
}
///
/// Constructs an S3Object.
///
/// Byte array representing the object
/// Metadata associated with the object
public S3Object( byte [] bytes, SortedList metadata ) {
this.bytes = bytes;
this.metadata = metadata;
}
///
/// Constructs an S3Object.
///
/// String representation of the data; this will be decoded via ASCII
/// Metadata associated with the object
public S3Object(string data, SortedList metadata)
{
ASCIIEncoding encoder = new ASCIIEncoding();
this.bytes = encoder.GetBytes( data.ToCharArray() );
this.metadata = metadata;
}
///
/// Constructs an S3Object.
///
/// String representation of the data; this will be decoded via ASCII
/// Metadata associated with the object
public S3Object(string data) {
ASCIIEncoding encoder = new ASCIIEncoding();
this.bytes = encoder.GetBytes(data.ToCharArray());
this.metadata = null;
}
}
}