C# Class Amazon.S3.IO.S3FileInfo

Mimics the System.IO.FileInfo for a file in S3. It exposes properties and methods manipulating files in S3.
Inheritance: IS3FileSystemInfo
Show file Open project: scopely/aws-sdk-net Class Usage Examples

Private Properties

Property Type Description
ExistsWithBucketCheck bool
SameClient bool

Public Methods

Method Description
CopyFromLocal ( string srcFileName ) : S3FileInfo

Copies the file from the local file system to S3. If the file already exists in S3 than an ArgumentException is thrown.

CopyFromLocal ( string srcFileName, bool overwrite ) : S3FileInfo

Copies the file from the local file system to S3. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

CopyTo ( S3DirectoryInfo dir ) : S3FileInfo

Copies this file to the target directory. If the file already exists in S3 than an ArgumentException is thrown.

CopyTo ( S3DirectoryInfo dir, bool overwrite ) : S3FileInfo

Copies this file to the target directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

CopyTo ( S3FileInfo file ) : S3FileInfo

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 than an ArgumentException is thrown.

CopyTo ( S3FileInfo file, bool overwrite ) : S3FileInfo

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

CopyTo ( string newBucket, string newKey ) : S3FileInfo

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 than an ArgumentException is thrown.

CopyTo ( string newBucket, string newKey, bool overwrite ) : S3FileInfo

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

CopyToLocal ( string destFileName ) : FileInfo

Copies from S3 to the local file system. If the file already exists on the local file system than an ArgumentException is thrown.

CopyToLocal ( string destFileName, bool overwrite ) : FileInfo

Copies from S3 to the local file system. If the file already exists on the local file system and overwrite is set to false than an ArgumentException is thrown.

Create ( ) : Stream

Returns a Stream that can be used to write data to S3. The content is persisted to S3 once the Stream is closed.

CreateText ( ) : StreamWriter

Returns a StreamWriter that can be used to write data to S3. The content is persisted to S3 once the StreamWriter is closed.

Delete ( ) : void

Deletes the from S3.

MoveFromLocal ( string path ) : S3FileInfo

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 than an ArgumentException is thrown.

MoveFromLocal ( string path, bool overwrite ) : S3FileInfo

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

MoveTo ( S3DirectoryInfo path ) : S3FileInfo

Moves the file to a a new location in S3.

MoveTo ( S3FileInfo file ) : S3FileInfo

Moves the file to a a new location in S3.

MoveTo ( string bucket, string key ) : S3FileInfo

Moves the file to a a new location in S3.

MoveToLocal ( string path ) : FileInfo

Moves the file from S3 to the local file system in the location indicated by the path parameter.

OpenRead ( ) : Stream

Returns a Stream for reading the contents of the file.

OpenText ( ) : StreamReader

Returns a StreamReader for reading the contents of the file.

OpenWrite ( ) : Stream

Returns a Stream for writing to S3. If the file already exists it will be overwritten.

Replace ( S3DirectoryInfo destDir, S3DirectoryInfo backupDir ) : S3FileInfo

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupDir is specifed then the content of destination file is backup to it.

Replace ( S3FileInfo destFile, S3FileInfo backupFile ) : S3FileInfo

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupFile is specifed then the content of destination file is backup to it.

Replace ( string destinationBucket, string destinationKey, string backupBucket, string backupKey ) : S3FileInfo

Replaces the destination file with the content of this file and then deletes the orignial file. If a backup location is specifed then the content of destination file is backup to it.

ReplaceLocal ( string destinationFileName, string destinationBackupFileName ) : FileInfo

Replaces the content of the destination file on the local file system with the content from this file from S3. If a backup file is specified then the content of the destination file is backup to it.

S3FileInfo ( IAmazonS3 s3Client, string bucket, string key ) : System

Initialize a new instance of the S3FileInfo class for the specified S3 bucket and S3 object key.

ToString ( ) : string

Private Methods

Method Description
ExistsWithBucketCheck ( bool &bucketExists ) : bool
SameClient ( S3FileInfo otherFile ) : bool

Method Details

CopyFromLocal() public method

Copies the file from the local file system to S3. If the file already exists in S3 than an ArgumentException is thrown.
If the file already exists in S3.
public CopyFromLocal ( string srcFileName ) : S3FileInfo
srcFileName string Location of the file on the local file system to copy.
return S3FileInfo

CopyFromLocal() public method

Copies the file from the local file system to S3. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.
If the file already exists in S3 and overwrite is set to false.
public CopyFromLocal ( string srcFileName, bool overwrite ) : S3FileInfo
srcFileName string Location of the file on the local file system to copy.
overwrite bool Determines whether the file can be overwritten.
return S3FileInfo

CopyTo() public method

Copies this file to the target directory. If the file already exists in S3 than an ArgumentException is thrown.
If the directory does not exist. If the file already exists in S3.
public CopyTo ( S3DirectoryInfo dir ) : S3FileInfo
dir S3DirectoryInfo Target directory where to copy the file to.
return S3FileInfo

CopyTo() public method

Copies this file to the target directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.
If the directory does not exist. If the file already exists in S3 and overwrite is set to false.
public CopyTo ( S3DirectoryInfo dir, bool overwrite ) : S3FileInfo
dir S3DirectoryInfo Target directory where to copy the file to.
overwrite bool Determines whether the file can be overwritten.
return S3FileInfo

CopyTo() public method

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 than an ArgumentException is thrown.
If the file already exists in S3.
public CopyTo ( S3FileInfo file ) : S3FileInfo
file S3FileInfo The target location to copy this file to.
return S3FileInfo

CopyTo() public method

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.
If the file already exists in S3 and overwrite is set to false.
public CopyTo ( S3FileInfo file, bool overwrite ) : S3FileInfo
file S3FileInfo The target location to copy this file to.
overwrite bool Determines whether the file can be overwritten.
return S3FileInfo

CopyTo() public method

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 than an ArgumentException is thrown.
public CopyTo ( string newBucket, string newKey ) : S3FileInfo
newBucket string S3 bucket to copy the file to.
newKey string S3 object key to copy the file to.
return S3FileInfo

CopyTo() public method

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.
If the file already exists in S3 and overwrite is set to false.
public CopyTo ( string newBucket, string newKey, bool overwrite ) : S3FileInfo
newBucket string S3 bucket to copy the file to.
newKey string S3 object key to copy the file to.
overwrite bool Determines whether the file can be overwritten.
return S3FileInfo

CopyToLocal() public method

Copies from S3 to the local file system. If the file already exists on the local file system than an ArgumentException is thrown.
If the file already exists locally.
public CopyToLocal ( string destFileName ) : FileInfo
destFileName string The path where to copy the file to.
return System.IO.FileInfo

CopyToLocal() public method

Copies from S3 to the local file system. If the file already exists on the local file system and overwrite is set to false than an ArgumentException is thrown.
If the file already exists locally and overwrite is set to false.
public CopyToLocal ( string destFileName, bool overwrite ) : FileInfo
destFileName string The path where to copy the file to.
overwrite bool Determines whether the file can be overwritten.
return System.IO.FileInfo

Create() public method

Returns a Stream that can be used to write data to S3. The content is persisted to S3 once the Stream is closed.
public Create ( ) : Stream
return Stream

CreateText() public method

Returns a StreamWriter that can be used to write data to S3. The content is persisted to S3 once the StreamWriter is closed.
public CreateText ( ) : StreamWriter
return System.IO.StreamWriter

Delete() public method

Deletes the from S3.
public Delete ( ) : void
return void

MoveFromLocal() public method

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 than an ArgumentException is thrown.
If the file already exists locally.
public MoveFromLocal ( string path ) : S3FileInfo
path string The local file system path where the files are to be moved.
return S3FileInfo

MoveFromLocal() public method

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.
If the file already exists in S3 and overwrite is set to false.
public MoveFromLocal ( string path, bool overwrite ) : S3FileInfo
path string The local file system path where the files are to be moved.
overwrite bool Determines whether the file can be overwritten.
return S3FileInfo

MoveTo() public method

Moves the file to a a new location in S3.
If the file already exists in S3.
public MoveTo ( S3DirectoryInfo path ) : S3FileInfo
path S3DirectoryInfo The target directory to copy to.
return S3FileInfo

MoveTo() public method

Moves the file to a a new location in S3.
If the file already exists in S3.
public MoveTo ( S3FileInfo file ) : S3FileInfo
file S3FileInfo The target file to copy to.
return S3FileInfo

MoveTo() public method

Moves the file to a a new location in S3.
If the file already exists in S3.
public MoveTo ( string bucket, string key ) : S3FileInfo
bucket string Bucket to move the file to.
key string Object key to move the file to.
return S3FileInfo

MoveToLocal() public method

Moves the file from S3 to the local file system in the location indicated by the path parameter.
If the file already exists locally.
public MoveToLocal ( string path ) : FileInfo
path string The location on the local file system to move the file to.
return System.IO.FileInfo

OpenRead() public method

Returns a Stream for reading the contents of the file.
The file is already open.
public OpenRead ( ) : Stream
return Stream

OpenText() public method

Returns a StreamReader for reading the contents of the file.
The file is already open.
public OpenText ( ) : StreamReader
return System.IO.StreamReader

OpenWrite() public method

Returns a Stream for writing to S3. If the file already exists it will be overwritten.
The file is already open.
public OpenWrite ( ) : Stream
return Stream

Replace() public method

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupDir is specifed then the content of destination file is backup to it.
public Replace ( S3DirectoryInfo destDir, S3DirectoryInfo backupDir ) : S3FileInfo
destDir S3DirectoryInfo Where the contents of this file will be copy to.
backupDir S3DirectoryInfo If specified the destFile is backup to it.
return S3FileInfo

Replace() public method

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupFile is specifed then the content of destination file is backup to it.
public Replace ( S3FileInfo destFile, S3FileInfo backupFile ) : S3FileInfo
destFile S3FileInfo Where the contents of this file will be copy to.
backupFile S3FileInfo If specified the destFile is backup to it.
return S3FileInfo

Replace() public method

Replaces the destination file with the content of this file and then deletes the orignial file. If a backup location is specifed then the content of destination file is backup to it.
public Replace ( string destinationBucket, string destinationKey, string backupBucket, string backupKey ) : S3FileInfo
destinationBucket string Destination bucket of this file will be copy to.
destinationKey string Destination object key of this file will be copy to.
backupBucket string Backup bucket to store the contents of the destination file.
backupKey string Backup object key to store the contents of the destination file.
return S3FileInfo

ReplaceLocal() public method

Replaces the content of the destination file on the local file system with the content from this file from S3. If a backup file is specified then the content of the destination file is backup to it.
public ReplaceLocal ( string destinationFileName, string destinationBackupFileName ) : FileInfo
destinationFileName string
destinationBackupFileName string
return System.IO.FileInfo

S3FileInfo() public method

Initialize a new instance of the S3FileInfo class for the specified S3 bucket and S3 object key.
public S3FileInfo ( IAmazonS3 s3Client, string bucket, string key ) : System
s3Client IAmazonS3 S3 client which is used to access the S3 resources.
bucket string Name of the S3 bucket.
key string The S3 object key.
return System

ToString() public method

public ToString ( ) : string
return string