ylbtech-Unitity-CS:Indexers
1.A,效果图返回顶部
 
1.B,源代码返回顶部
1.B.1,

// indexer.cs
// 参数:indexer.txt
using System;
using System.IO; // 将大文件当作字节数组
// 访问的类。
public class FileByteArray
{
Stream stream; // 包含用于访问
// 该文件的基础流。
// 创建封装特定文件的新 FileByteArray。
public FileByteArray(string fileName)
{
stream = new FileStream(fileName, FileMode.Open);
} // 关闭流。这应是
// 结束前的最后一个操作。
public void Close()
{
stream.Close();
stream = null;
} // 提供对文件的读/写访问的索引器。
public byte this[long index] // long 是 64 位整数
{
// 在偏移量 index 处读取一个字节,然后将其返回。
get
{
byte[] buffer = new byte[];
stream.Seek(index, SeekOrigin.Begin);
stream.Read(buffer, , );
return buffer[];
}
// 在偏移量 index 处写入一个字节,然后将其返回。
set
{
byte[] buffer = new byte[] {value};
stream.Seek(index, SeekOrigin.Begin);
stream.Write(buffer, , );
}
} // 获取文件的总长度。
public long Length
{
get
{
return stream.Seek(, SeekOrigin.End);
}
}
} // 演示 FileByteArray 类。
// 反转文件中的字节。
public class Reverse
{
public static void Main(String[] args)
{
// 检查参数。
if (args.Length != )
{
Console.WriteLine("Usage : Indexer <filename>");
return;
} // 检查文件是否存在
if (!System.IO.File.Exists(args[]))
{
Console.WriteLine("File " + args[] + " not found.");
return;
} FileByteArray file = new FileByteArray(args[]);
long len = file.Length; // 交换文件中的字节以对其进行反转。
for (long i = ; i < len / ; ++i)
{
byte t; // 请注意,为“file”变量建立索引会调用
// FileByteStream 类上的索引器,该索引器在文件中读取
// 和写入字节。
t = file[i];
file[i] = file[len - i - ];
file[len - i - ] = t;
} file.Close();
}
}
1.B.2,
1.C,下载地址返回顶部
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

ylbtech-Unitity-CS:Indexers的更多相关文章

  1. Class:DbConnectionManipulator.cs

    ylbtech-Class:DbConnectionManipulator.cs 1.返回顶部 1.DbConnectionManipulator.cs using System; using Sys ...

  2. ASP.NET MVC:UrlHelper.cs

    ylbtech-funcation-Utility: ASP.NET MVC:UrlHelper.cs 充当表示 ASP.NET Razor 页的类的基类. 1.UrlHelper 类返回顶部 1-1 ...

  3. ASP.NET MVC:WebPageBase.cs

    ylbtech-funcation-Utility: ASP.NET MVC:WebPageBase.cs 充当表示 ASP.NET Razor 页的类的基类. 1.A,WebPageBase 抽象类 ...

  4. ASP.NET MVC:WebPageRenderingBase.cs

    ylbtech-funcation-Utility: ASP.NET MVC:WebPageRenderingBase.cs 提供用于呈现使用 Razor 视图引擎的页的方法和属性. 1.A,WebP ...

  5. ASP.NET MVC:WebViewPage.cs

    ylbtech-funcation-Utility: ASP.NET MVC:WebViewPage.cs 表示呈现使用 ASP.NET Razor 语法的视图所需的属性和方法. 1.A,WebVie ...

  6. Unitity 常用工具类

    ylbtech-Unitity_C#: Unitity 常用代码 1.A,效果图返回顶部   1.B,源代码返回顶部 1,日期字符串 using System; using System.Xml; / ...

  7. Class-SP:Order.cs

    ylbtech-Class-SP:Order.cs 1. 返回顶部 1.GoodsType.cs 货品类别 using System; using System.Collections.Generic ...

  8. System.Net.FtpWebRequest.cs

    ylbtech-System.Net.FtpWebRequest.cs 实现文件传输协议(FTP)客户端. 1.返回顶部 1. #region 程序集 System, Version=4.0.0.0, ...

  9. System.Net.WebRequest.cs

    ylbtech-System.Net.WebRequest.cs 发出对统一资源标识符(URI)的请求.这是一个 abstract 类. 1.返回顶部 1. #region 程序集 System, V ...

随机推荐

  1. 黑马程序员——JAVA基础之主函数main和静态static,静态代码块

    ------- android培训.java培训.期待与您交流! ---------- 主函数:是一个特殊的函数.作为程序的入口,可以被jvm调用. 主函数的定义: public:代表着该函数访问权限 ...

  2. 【转】 iOS 开发之静态库.a和动态库详解 -- 不错

    原文网址:http://blog.csdn.net/lxl_815520/article/details/52154331 一, 简单介绍 1.什么是库 库是程序代码的集合,是共享程序代码的一种方式 ...

  3. lua堆栈操作常用函数学习二

    /* ** basic stack manipulation */ LUA_API int  <strong> (lua_gettop) (lua_State *L);  </str ...

  4. dede模板完全控制攻略

    1.使用php代码 @me代表了当前字段的值 {dede:tagname runphp='yes'} @me = "123456";//如果使用了自定义函数 则@me得到的是函数返 ...

  5. Python中urlretrieve函数

    API定义: urllib.request.urlretrieve(url,filename=None,reporthook=None, data=None) 利用urlretrieve() 将数据下 ...

  6. nmap与ntop

    http://blog.csdn.net/aspirationflow/article/details/7694274

  7. .net framework4与其client profile版本的区别

    简而言之,client profile版本是完整版本的一个子集.包含大多数最常用的功能并减小了体积,以便更容易的安装和发布,同时还有微软所声称的一些好处,比如因为减少了某些库,所以使其更加安全等等. ...

  8. 【性能诊断】四、单功能场景的性能分析(RedGate,找到同一个客户端的并发请求被串行化问题)

    问题描述: 客户端js连续发起两个异步http请求,请求地址相同,但参数不同:POST http://*.*.*.*/*****/webservice/RESTFulWebService/RESTFu ...

  9. ASP.NET MVC3在页面上获取当前控制器名称、Action名称以及路由参数

    参考:http://ulfqbpl.blog.163.com/blog/static/87783552201272824843607/ 获取控制器名称: RouteData.Values[" ...

  10. ibats注意

    <isNotEqual property="id" compareValue="0" prepend="and">id=#id# ...