Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(148)

Side by Side Diff: Src/GoogleApis/Apis/Discovery/StringDiscoveryDevice.cs

Issue 12020043: Issue 325 - Remove discovery and codegen (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: Sir miceli comment Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 Copyright 2010 Google Inc
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 using System;
18 using System.IO;
19 using System.Text;
20
21 namespace Google.Apis.Discovery
22 {
23 /// <summary>
24 /// Hosts the DiscoveryDocument in a user defined stream.
25 ///·
26 /// Handy for testing.
27 /// </summary>
28 public class StringDiscoveryDevice : IDiscoveryDevice
29 {
30 /// <summary>
31 /// The discovery document.
32 /// </summary>
33 public String Document { get; set; }
34
35 private Stream outputStream { get; set; }
36
37 /// <summary>
38 /// Creates a new StringDiscoveryDevice.
39 /// </summary>
40 public StringDiscoveryDevice() {}
41
42 /// <summary>
43 /// Creates a new StringDiscoveryDevice.
44 /// </summary>
45 /// <param name="document">The string containing the discovery document< /param>
46 public StringDiscoveryDevice(string document)
47 {
48 Document = document;
49 }
50
51 #region IDiscoveryDevice Members
52
53 /// <summary>
54 /// Fetches the Discovery Document from an user supplied string
55 /// </summary>
56 /// <returns>
57 /// A <see cref="System.String"/>
58 /// </returns>
59 public Stream Fetch()
60 {
61 byte[] text = Encoding.UTF8.GetBytes(Document);
62 outputStream = new MemoryStream(text);
63 return outputStream;
64 }
65
66 #endregion
67
68 #region IDisposable implementation
69
70 public void Dispose()
71 {
72 if (outputStream != null)
73 {
74 outputStream.Dispose();
75 }
76 }
77
78 #endregion
79 }
80 }
OLDNEW
« no previous file with comments | « Src/GoogleApis/Apis/Discovery/StreamDiscoveryDevice.cs ('k') | Src/GoogleApis/Apis/Discovery/WebDiscoveryDevice.cs » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b