jellyfin-server/MediaBrowser.Model/Serialization/IJsonSerializer.cs
LukePulverenti 8ce3e74e81 More DI
2013-02-24 16:53:54 -05:00

103 lines
3.7 KiB
C#

using System;
using System.IO;
namespace MediaBrowser.Model.Serialization
{
public interface IJsonSerializer
{
/// <summary>
/// Serializes to stream.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj">The obj.</param>
/// <param name="stream">The stream.</param>
/// <exception cref="System.ArgumentNullException">obj</exception>
void SerializeToStream<T>(T obj, Stream stream)
where T : class;
/// <summary>
/// Serializes to file.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj">The obj.</param>
/// <param name="file">The file.</param>
/// <exception cref="System.ArgumentNullException">obj</exception>
void SerializeToFile<T>(T obj, string file)
where T : class;
/// <summary>
/// Deserializes from file.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="file">The file.</param>
/// <returns>System.Object.</returns>
/// <exception cref="System.ArgumentNullException">type</exception>
object DeserializeFromFile(Type type, string file);
/// <summary>
/// Deserializes from file.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="file">The file.</param>
/// <returns>``0.</returns>
/// <exception cref="System.ArgumentNullException">file</exception>
T DeserializeFromFile<T>(string file)
where T : class;
/// <summary>
/// Deserializes from stream.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="stream">The stream.</param>
/// <returns>``0.</returns>
/// <exception cref="System.ArgumentNullException">stream</exception>
T DeserializeFromStream<T>(Stream stream);
/// <summary>
/// Deserializes from string.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="text">The text.</param>
/// <returns>``0.</returns>
/// <exception cref="System.ArgumentNullException">text</exception>
T DeserializeFromString<T>(string text);
/// <summary>
/// Deserializes from stream.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
/// <exception cref="System.ArgumentNullException">stream</exception>
object DeserializeFromStream(Stream stream, Type type);
/// <summary>
/// Deserializes from string.
/// </summary>
/// <param name="json">The json.</param>
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
/// <exception cref="System.ArgumentNullException">json</exception>
object DeserializeFromString(string json, Type type);
/// <summary>
/// Serializes to string.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj">The obj.</param>
/// <returns>System.String.</returns>
/// <exception cref="System.ArgumentNullException">obj</exception>
string SerializeToString<T>(T obj)
where T : class;
/// <summary>
/// Serializes to bytes.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj">The obj.</param>
/// <returns>System.Byte[][].</returns>
/// <exception cref="System.ArgumentNullException">obj</exception>
byte[] SerializeToBytes<T>(T obj)
where T : class;
}
}