18 using System.Collections.Specialized;
22 namespace Deveel.Data.Configuration {
29 : this(new Uri(url)) {
32 public Uri Url {
get;
private set; }
34 public Stream InputStream {
37 using (var client =
new WebClient()) {
38 var data = client.DownloadData(Url);
39 return new MemoryStream(data,
false);
41 }
catch (Exception ex) {
47 public Stream OutputStream {
51 #region WebOutputStream
54 private readonly Uri
url;
60 baseStream =
new MemoryStream(1024);
65 throw new IOException(
"The stream is closed and cannot be written.");
74 var data = baseStream.ToArray();
75 using (var client =
new WebClient()) {
76 client.UploadData(url, data);
81 public override long Seek(
long offset, SeekOrigin origin) {
85 return baseStream.Seek(offset, origin);
93 baseStream.SetLength(value);
97 public override int Read(byte[] buffer,
int offset,
int count) {
98 throw new NotSupportedException();
101 public override void Write(byte[] buffer,
int offset,
int count) {
105 baseStream.Write(buffer, offset, count);
109 public override bool CanRead {
110 get {
return false; }
113 public override bool CanSeek {
117 public override bool CanWrite {
118 get {
return false; }
121 public override long Length {
124 return baseStream.Length;
129 public override long Position {
132 return baseStream.Position;
138 baseStream.Position = value;
override long Seek(long offset, SeekOrigin origin)
UrlConfigSource(string url)
A source for stored configurations or destination to configurations to store.
override int Read(byte[] buffer, int offset, int count)
readonly MemoryStream baseStream
override void Write(byte[] buffer, int offset, int count)
override void SetLength(long value)