本文整理汇总了C#中System.IO.Stream类的典型用法代码示例。如果您正苦于以下问题:C# System.IO.Stream类的具体用法?C# System.IO.Stream怎么用?C# System.IO.Stream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.IO.Stream类属于命名空间,在下文中一共展示了System.IO.Stream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SignatureReadingStream
public SignatureReadingStream(System.IO.Stream stream, System.Security.Cryptography.RSACryptoServiceProvider key)
{
if (!VerifySignature(stream, key))
throw new System.IO.InvalidDataException("Unable to verify signature");
m_stream = stream;
this.Position = 0;
}
示例2: ZOutputStream
public ZOutputStream(System.IO.Stream out_Renamed, int level):base()
{
InitBlock();
this.out_Renamed = out_Renamed;
z.deflateInit(level);
compress = true;
}
示例3: OpenedFile
public OpenedFile(String path)
{
baseStream = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
filePath = path;
overlay = new Dictionary<Int64, byte[]>();
fileLength = baseStream.Length;
}
示例4: HTML
/// <summary>
/// Constructor
/// </summary>
/// <param name="p_Mode"></param>
/// <param name="p_ImageFullPath">The path to write embedded images files</param>
/// <param name="p_ImageRelativePath">The path used in the HTML source. If you save the images in the same path of the HTML file you can leave this path empty.</param>
/// <param name="p_HtmlStream">The stream to write</param>
public HTML(ExportHTMLMode p_Mode, string p_ImageFullPath , string p_ImageRelativePath, System.IO.Stream p_HtmlStream)
{
m_Mode = p_Mode;
m_Stream = p_HtmlStream;
m_ImageFullPath = p_ImageFullPath;
m_ImageRelativePath = p_ImageRelativePath;
}
示例5: ProgressStream
public ProgressStream(System.IO.Stream file)
{
this.file = file;
length = file.Length;
bytesRead = 0;
if (ProgressChanged != null) ProgressChanged(this, new ProgressChangedEventArgs(bytesRead, length));
}
示例6: Init
public void Init(System.IO.Stream stream) {
m_Stream = stream;
m_ProcessedSize = 0;
m_Limit = 0;
m_Pos = 0;
m_StreamWasExhausted = false;
}
示例7: ReadableDataStorageOnStream
public ReadableDataStorageOnStream(System.IO.Stream stream, bool ownsStream)
{
if (stream == null)
throw new System.ArgumentNullException(nameof(stream));
_stream = stream;
_ownsStream = ownsStream;
}
示例8: ZipCipherStream
/// <summary>
/// The constructor.
/// </summary>
/// <param name="s">The underlying stream</param>
/// <param name="mode">To either encrypt or decrypt.</param>
/// <param name="cipher">The pre-initialized ZipCrypto object.</param>
public ZipCipherStream(System.IO.Stream s, ZipCrypto cipher, CryptoMode mode)
: base()
{
_cipher = cipher;
_s = s;
_mode = mode;
}
示例9: InputStreamSource
public InputStreamSource(System.IO.Stream in_Renamed)
{
if (in_Renamed == null)
throw new System.NullReferenceException("in");
this.in_Renamed = in_Renamed;
}
示例10: Backup
/// <summary>
/// Adds a file to the archive
/// </summary>
/// <param name="entry">
/// The backup metadata for the file
/// </param>
/// <param name="stream">
/// The file stream to add to the archive
/// </param>
public void Backup(Backup.Entry entry, Stream stream)
{
// if we are not currently uploading a vault archive,
// then attach a new uploader and create a blob for it
if (this.uploader == null)
{
this.uploader = new GlacierUploader(
this.archive.Glacier,
this.archive.Vault
);
this.archive.BackupIndex.InsertBlob(
new Backup.Blob()
{
Name = this.uploader.UploadID
}
);
}
// fetch the upload blob and sync it with the uploader's offset
var blob = this.archive.BackupIndex.LookupBlob(this.uploader.UploadID);
if (blob.Length != this.uploader.Length)
blob.Length = this.uploader.Resync(blob.Length);
// upload the incoming stream and update the backup entry
var offset = this.uploader.Length;
var length = this.uploader.Upload(stream);
entry.Blob = blob;
entry.Offset = offset;
entry.Length = length;
}
示例11: init
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: static void init(boolean ignoreCase, String affix, String... dictionaries) throws java.io.IOException, java.text.ParseException
internal static void init(bool ignoreCase, string affix, params string[] dictionaries)
{
if (dictionaries.Length == 0)
{
throw new System.ArgumentException("there must be at least one dictionary");
}
System.IO.Stream affixStream = typeof(StemmerTestBase).getResourceAsStream(affix);
if (affixStream == null)
{
throw new FileNotFoundException("file not found: " + affix);
}
System.IO.Stream[] dictStreams = new System.IO.Stream[dictionaries.Length];
for (int i = 0; i < dictionaries.Length; i++)
{
dictStreams[i] = typeof(StemmerTestBase).getResourceAsStream(dictionaries[i]);
if (dictStreams[i] == null)
{
throw new FileNotFoundException("file not found: " + dictStreams[i]);
}
}
try
{
Dictionary dictionary = new Dictionary(affixStream, Arrays.asList(dictStreams), ignoreCase);
stemmer = new Stemmer(dictionary);
}
finally
{
IOUtils.closeWhileHandlingException(affixStream);
IOUtils.closeWhileHandlingException(dictStreams);
}
}
示例12: BackupReader
public BackupReader(string path)
{
System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
fs.ReadByte();
inputStream = fs;
inputStream.Seek(0, System.IO.SeekOrigin.Begin);
}
示例13: DelegatingStream
/// <summary>
/// Initializes a new instance of the <see cref="DelegatingStream"/> class from the specified
/// <see cref="Stream"/>.
/// </summary>
/// <param name="underlyingStream">The stream to wrap.</param>
/// <param name="ownsStream">
/// <para><see langword="true"/> if this object owns the wrapped stream, and should dispose
/// of it when this instance is closed or disposed.</para>
/// <para>-or-</para>
/// <para><see langword="false"/> if this object should not dispose of the wrapped stream.</para>
/// <para>The default value is <see langword="true"/>.</para>
/// </param>
/// <exception cref="ArgumentNullException">
/// If <paramref name="underlyingStream"/> is <see langword="null"/>.
/// </exception>
public DelegatingStream(Stream underlyingStream, bool ownsStream)
{
if (underlyingStream == null)
throw new ArgumentNullException("underlyingStream");
_underlyingStream = underlyingStream;
_ownsStream = ownsStream;
}
示例14: openSocket
/*
*
*/
public virtual void openSocket()
{
socket = new System.Net.Sockets.TcpClient(host, port);
socket.LingerState = new System.Net.Sockets.LingerOption(true, 1000);
os = socket.GetStream();
is_Renamed = socket.GetStream();
}
示例15: setOutputStream
/// <summary> Sets the underlying output stream to which messages are written. </summary>
public virtual void setOutputStream(System.IO.Stream out_Renamed)
{
lock (this)
{
myOutputStream = out_Renamed;
myWriter = new System.IO.StreamWriter(getWriter(out_Renamed).BaseStream, getWriter(out_Renamed).Encoding);
}
}