**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Dime / DimeAttachment.cs
blob23a5b0196c199568814c1ce39a4bc2188e5ee403
1 //
2 // Microsoft.Web.Services.Dime.DimeAttachment.cs
3 //
4 // Name: Duncan Mak (duncan@ximian.com)
5 //
6 // Copyright (C) Ximian, Inc. 2003
7 //
9 using System;
10 using System.IO;
12 namespace Microsoft.Web.Services.Dime {
14 public class DimeAttachment
16 int chunk_size = Int32.MaxValue; // docs list this as default
17 string id;
18 string type;
19 Stream stream;
20 TypeFormatEnum type_format;
22 public DimeAttachment ()
24 id = String.Empty;
25 stream = null;
26 type = null;
27 type_format = TypeFormatEnum.Unchanged;
30 public DimeAttachment (string type, TypeFormatEnum typeFormat, string path)
32 this.type = type;
33 this.type_format = typeFormat;
35 if (File.Exists (path) == false)
36 throw new FileNotFoundException (
37 Locale.GetText ("The path is not valid."));
40 public DimeAttachment (string type, TypeFormatEnum typeFormat, Stream stream)
42 this.type = type;
43 this.type_format = typeFormat;
44 this.stream = stream;
47 public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, string path)
48 : this (type, typeFormat, path)
50 this.id = id;
53 public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, Stream stream)
54 : this (type, typeFormat, stream)
56 this.id = id;
59 public int ChunkSize {
61 get { return chunk_size; }
63 set { chunk_size = value; }
66 public string Id {
68 get { return id; }
70 set { id = value; }
73 public Stream Stream {
75 get { return stream; }
77 set {
78 if (value == null)
79 throw new ArgumentNullException (
80 Locale.GetText ("Argument is null."));
81 stream = value;
85 public string Type {
87 get { return type; }
89 set { type = value; }
92 public TypeFormatEnum TypeFormat {
94 get { return type_format; }
96 set { type_format = value; }