using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace SDKCSharp.Utility
{
public class FileUtil
{
///
/// 获取文件名,带后缀
///
/// 文件全路径
/// 返回文件名
public static string GetFileName(string filePath)
{
return Path.GetFileName(filePath);
}
///
/// 读取文件,将文件内容转成byte数组
///
/// 文件路径
///
public static byte[] ReadFile(string filePath)
{
return File.ReadAllBytes(filePath);
}
///
/// 将FileStream内容转成byte数组
///
/// FileStream
///
public static byte[] ReadFile(FileStream fs)
{
byte[] buffer = new byte[fs.Length];
using (BinaryWriter bw = new BinaryWriter(fs))
{
bw.Write(buffer);
}
return buffer;
}
}
}