«勤奋自学成大器读后感»的作者介绍

&GE Fanuc的PLC & PAC系统的RX3i &IC694ALG392
&GE Fanuc的PLC & PAC系统的RX3i &IC694ALG392
&GE Fanuc的PLC & PAC系统的RX3i &IC694ALG392
&GE Fanuc的PLC & PAC系统的RX3i &IC694ALG392
&GE Fanuc的PLC & PAC系统的RX3i &IC694ALG392
IC694ALG392
说明:模拟量输出,电压/电流,8点&
想要更多详情请呼 ,或传 (颜小姐收)或发
PLC的类型繁复,功用和指令体系也不尽相同,但布局与作业原理则迥然不同,一般由主机、输入/输出接口、电源拓展器接口和外部设备接口等几个首要有些构成。PLC的硬件体系布局如下图所示:&
主机有些包含中央处理器(CPU)、体系程序存储器和用户程序及数据存储器。CPU是PLC的中心,它用以运行用户程序、监控输入/输出接口状态、作出逻辑判别和进行数据处理,即读取输入变量、完结用户指令规定的各种操作,将成果送到输出端,并呼应外部设备(如电脑、打印机等)的恳求以及进行各种内部判别等。PLC的内部存储器有两类,一类是体系程序存储器,首要寄存体系管理和监控程序及对用户程序作编译处理的程序,体系程序已由厂家固定,用户不能更改;另一类是用户程序及数据存储器,首要寄存用户编制的应用程序及各种暂存数据和中心成果。
2、输入/输出(I/O)接口
外部设备接口
此接口可将打印机、条码扫描仪,变频器等外部设备与主机相联,以完结相应的操作。
试验设备供给的主机类型有西门子S7-200系列的CPU224(AC/DC/RELAY)。输入点数为14,输出点数为10;CPU226(AC/DC/RELAY),输入点数为26,输出点数为14。
Siemens Simovert VC 6SE 6SE7 016-1TA61
Bosch CNC Servo Mat. Nr. 404 303
SIEMENS SMP-E327 C-1
PHOENIX CONTACT RFC 430 ETH-IB Remote Field Controller
Siemens Servomotor 1GG 51160-OFY40-6HU7-Z
Siemens Leistungsschalter 3VF-0AB1
Siemens Simatic S5 6ES5 374-1KG11 6ES E: 1
Centerline ARBB5B7UDF revo RD0
Siemens Leistungsschalter 3VF-0AN1
SIEMENS SIMOREG E150/15 6RA-0 6 RA
Siemens 9AC 9AC9 100-4AA11
SEW Eurodrive Getriebemotor F 57 CMP63M/BP/KY/AKOH/SB1&
SEW Eurodrive Servo-Getriebemotor FA 37B CM90S/TF/RH1M/...
Siemens Servomotor 1FT-4AD1-Z
Indramat Servomotor 2 AD 100C-B50A1-AS03-B2N1
(文:GE &来源:模具联盟网)
联系我们时请一定说明是在模具联盟网上看到的此信息,谢谢!
联系电话:,欢迎您的来电咨询!
本页网址:
推荐关键词:»IC694ALG392
更多相关信息
无相关信息
发表评论共有位网友发表了评论
版权与免责声明:
①凡本网注明"来源:模具联盟网"的所有作品,版权均属于模具联盟网,转载请必须注明模具联盟网,违反者本网将追究相关法律责任。
②本网转载并注明自其它来源的作品,目的在于传递更多信息,并不代表本网赞同其观点或证实其内容的真实性,不承担此类作品侵权行为的直接责任及连带责任。其他媒体、网站或个人从本网转载时,必须保留本网注明的作品来源,并自负版权等法律责任。
③如涉及作品内容、版权等问题,请在作品发表之日起一周内与本网联系,否则视为放弃相关权利。
联 系 人:
联系地址:
厦门市湖里区五缘湾运营中心
联系电话:
在线咨询:
企业网址:
公司网站:
联系我时,
告知来自模具联盟网
111  本报记者李皓璧  傅苹,原苏州大学今天看啥 热点:
Java IO 之 FileInputStream & FileOutputStream源码分析,iofileinputstreamio&java&FileInputStream&FileOutputStream
二、FileInputStream源码分析
三、FileOutputStream 源码分析
四、使用案例
五、思考与小结
Writer&&&&& :BYSocket(泥沙砖瓦浆木匠)
微&&&&&&&& 博:BYSocket
豆&&&&&&&& 瓣:BYSocket
FaceBook:BYSocket
Twitter&&& :BYSocket
文件,作为常见的数据源。关于操作文件的字节流就是 &&FileInputStream&&&FileOutputStream。它们是Basic IO字节流中重要的实现类。
二、FileInputStream源码分析
FileInputStream源码如下:
&* FileInputStream 从文件系统的文件中获取输入字节流。文件取决于主机系统。
&*& 比如读取图片等的原始字节流。如果读取字符流,考虑使用 FiLeReader。
publicclassSFileInputStream extendsInputStream
&&&&private final FileD
&&&&private final S
&&&&private FileChannel channel = null;
&&&&private final Object closeLock = new Object();
&&&&private volatile boolean closed = false;
&&&&private static final ThreadLocal&Boolean& runningFinalize =
&&&&&&&&new ThreadLocal&&();
&&&&private static boolean isRunningFinalize() {
&&&&&&&&if ((val = runningFinalize.get()) != null)
&&&&&&&&&&&&return val.booleanValue();
&&&&&&&&return false;
&&&&public FileInputStream(String name) throws FileNotFoundException {
&&&&&&&&this(name != null ? new File(name) : null);
&&&&public FileInputStream(File file) throws FileNotFoundException {
&&&&&&&&String name = (file != null ? file.getPath() : null);
&&&&&&&&SecurityManager security = System.getSecurityManager();
&&&&&&&&if (security != null) {
&&&&&&&&&&&&security.checkRead(name);
&&&&&&&&if (name == null) {
&&&&&&&&&&&&throw new NullPointerException();
&&&&&&&&if (file.isInvalid()) {
&&&&&&&&&&&&throw new FileNotFoundException("Invalid file path");
&&&&&&&&fd = new FileDescriptor();
&&&&&&&&fd.incrementAndGetUseCount();
&&&&&&&&this.path =
&&&&&&&&open(name);
&&&&public FileInputStream(FileDescriptor fdObj) {
&&&&&&&&SecurityManager security = System.getSecurityManager();
&&&&&&&&if (fdObj == null) {
&&&&&&&&&&&&throw new NullPointerException();
&&&&&&&&if (security != null) {
&&&&&&&&&&&&security.checkRead(fdObj);
&&&&&&&&fd = fdO
&&&&&&&&path = null;
&&&&&&&&fd.incrementAndGetUseCount();
&&&&private native void open(String name) throws FileNotFoundE
&&&&public int read() throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileReadBegin(path);
&&&&&&&&int b = 0;
&&&&&&&&try {
&&&&&&&&&&&&b = read0();
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileReadEnd(traceContext, b == -1 ? 0 : 1);
&&&&&&&&return b;
&&&&private native int read0() throws IOE
&&&&private native int readBytes(byte b[], int off, int len) throws IOE
&&&&public int read(byte b[]) throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileReadBegin(path);
&&&&&&&&int bytesRead = 0;
&&&&&&&&try {
&&&&&&&&&&&&bytesRead = readBytes(b, 0, b.length);
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileReadEnd(traceContext, bytesRead == -1 ? 0 : bytesRead);
&&&&&&&&return bytesR
&&&&public int read(byte b[], int off, int len) throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileReadBegin(path);
&&&&&&&&int bytesRead = 0;
&&&&&&&&try {
&&&&&&&&&&&&bytesRead = readBytes(b, off, len);
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileReadEnd(traceContext, bytesRead == -1 ? 0 : bytesRead);
&&&&&&&&return bytesR
&&&&public native long skip(long n) throws IOE
&&&&public native int available() throws IOE
&&&&public void close() throws IOException {
&&&&&&&&synchronized (closeLock) {
&&&&&&&&&&&&if (closed) {
&&&&&&&&&&&&&&&&return;
&&&&&&&&&&&&}
&&&&&&&&&&&&closed = true;
&&&&&&&&if (channel != null) {
&&&&&&&&&&&fd.decrementAndGetUseCount();
&&&&&&&&&&&channel.close();
&&&&&&&&int useCount = fd.decrementAndGetUseCount();
&&&&&&&&if ((useCount &= 0) || !isRunningFinalize()) {
&&&&&&&&&&&&close0();
&&&&public final FileDescriptor getFD() throws IOException {
&&&&&&&&if (fd != null) return
&&&&&&&&throw new IOException();
&&&&publicFileChannel getChannel() {
&&&&&&&&synchronized(this) {
&&&&&&&&&&&&if(channel == null) {
&&&&&&&&&&&&&&&&channel = FileChannelImpl.open(fd, path, true, false, this);
&&&&&&&&&&&&&&&&fd.incrementAndGetUseCount();
&&&&&&&&&&&&}
&&&&&&&&&&&&
&&&&privatestaticnativevoidinitIDs();
&&&&privatenativevoidclose0() throwsIOE
&&&&static{
&&&&&&&&initIDs();
&&&&protected void finalize() throws IOException {
&&&&&&&&if((fd != null) &&& (fd != FileDescriptor.in)) {
&&&&&&&&&&&&runningFinalize.set(Boolean.TRUE);
&&&&&&&&&&&&try{
&&&&&&&&&&&&&&&&close();
&&&&&&&&&&&&} finally{
&&&&&&&&&&&&&&&&runningFinalize.set(Boolean.FALSE);
&&&&&&&&&&&&}
1. 三个核心方法
三个核心方法,也就是Override(重写)了抽象类InputStream的read方法。
int read()&方法,即
public int read() throws IOException
代码实现中很简单,一个try中调用本地native的read0()方法,直接从文件输入流中读取一个字节。IoTrace.fileReadEnd(),字面意思是防止文件没有关闭读的通道,导致读文件失败,一直开着读的通道,会造成内存泄露。
int read(byte b[])&方法,即
public int read(byte b[]) throws IOException
代码实现也是比较简单的,也是一个try中调用本地native的readBytes()方法,直接从文件输入流中读取最多b.length个字节到byte数组b中。
int read(byte b[], int off, int len)&方法,即
public int read(byte b[], int off, int len) throws IOException
代码实现和 int read(byte b[])方法 一样,直接从文件输入流中读取最多len个字节到byte数组b中。
可是这里有个问:
Q: 为什么 int read(byte b[]) 方法需要自己独立实现呢? 直接调用 int read(byte b[], int off, int len) 方法,即read(b , 0 , b.length),等价于read(b)?
A:待完善,希望路过大神回。。。。向下兼容?? Finally??
2. 值得一提的native方法
上面核心方法中为什么实现简单,因为工作量都在native方法里面,即JVM里面实现了。native倒是不少一一列举吧:
native void open(String name) // 打开文件,为了下一步读取文件内容
native int read0() // 从文件输入流中读取一个字节
native int readBytes(byte b[], int off, int len) // 从文件输入流中读取,从off句柄开始的len个字节,并存储至b字节数组内。
native void close0() // 关闭该文件输入流及涉及的资源,比如说如果该文件输入流的FileChannel对被获取后,需要对FileChannel进行close。
其他还有值得一提的就是,在jdk1.4中,新增了NIO包,优化了一些IO处理的速度,所以在FileInputStream和FileOutputStream中新增了FileChannel&getChannel()的方法。即获取与该文件输入流相关的 java.nio.channels.FileChannel对象。
三、FileOutputStream 源码分析
FileOutputStream 源码如下:
&* 文件输入流是用于将数据写入文件或者文件描述符类
&*& 比如写入图片等的原始字节流。如果写入字符流,考虑使用 FiLeWriter。
publicclassSFileOutputStream extendsOutputStream
&&&&private final FileD
&&&&private final S
&&&&private final boolean
&&&&private FileC
&&&&private final Object closeLock = new Object();
&&&&private volatile boolean closed = false;
&&&&private static final ThreadLocal&Boolean& runningFinalize =
&&&&&&&&new ThreadLocal&&();
&&&&private static boolean isRunningFinalize() {
&&&&&&&&if ((val = runningFinalize.get()) != null)
&&&&&&&&&&&&return val.booleanValue();
&&&&&&&&return false;
&&&&public FileOutputStream(String name) throws FileNotFoundException {
&&&&&&&&this(name != null ? new File(name) : null, false);
&&&&public FileOutputStream(String name, boolean append)
&&&&&&&&throws FileNotFoundException
&&&&&&&&this(name != null ? new File(name) : null, append);
&&&&public FileOutputStream(File file) throws FileNotFoundException {
&&&&&&&&this(file, false);
&&&&public FileOutputStream(File file, boolean append)
&&&&&&&&throws FileNotFoundException
&&&&&&&&String name = (file != null ? file.getPath() : null);
&&&&&&&&SecurityManager security = System.getSecurityManager();
&&&&&&&&if (security != null) {
&&&&&&&&&&&&security.checkWrite(name);
&&&&&&&&if (name == null) {
&&&&&&&&&&&&throw new NullPointerException();
&&&&&&&&if (file.isInvalid()) {
&&&&&&&&&&&&throw new FileNotFoundException("Invalid file path");
&&&&&&&&this.fd = new FileDescriptor();
&&&&&&&&this.append =
&&&&&&&&this.path =
&&&&&&&&fd.incrementAndGetUseCount();
&&&&&&&&open(name, append);
&&&&public FileOutputStream(FileDescriptor fdObj) {
&&&&&&&&SecurityManager security = System.getSecurityManager();
&&&&&&&&if (fdObj == null) {
&&&&&&&&&&&&throw new NullPointerException();
&&&&&&&&if (security != null) {
&&&&&&&&&&&&security.checkWrite(fdObj);
&&&&&&&&this.fd = fdO
&&&&&&&&this.path = null;
&&&&&&&&this.append = false;
&&&&&&&&fd.incrementAndGetUseCount();
&&&&private native void open(String name, boolean append)
&&&&&&&&throws FileNotFoundE
&&&&private native void write(int b, boolean append) throws IOE
&&&&public void write(int b) throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileWriteBegin(path);
&&&&&&&&int bytesWritten = 0;
&&&&&&&&try {
&&&&&&&&&&&&write(b, append);
&&&&&&&&&&&&bytesWritten = 1;
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileWriteEnd(traceContext, bytesWritten);
&&&&private native void writeBytes(byte b[], int off, int len, boolean append)
&&&&&&&&throws IOE
&&&&public void write(byte b[]) throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileWriteBegin(path);
&&&&&&&&int bytesWritten = 0;
&&&&&&&&try {
&&&&&&&&&&&&writeBytes(b, 0, b.length, append);
&&&&&&&&&&&&bytesWritten = b.
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileWriteEnd(traceContext, bytesWritten);
&&&&public void write(byte b[], int off, int len) throws IOException {
&&&&&&&&Object traceContext = IoTrace.fileWriteBegin(path);
&&&&&&&&int bytesWritten = 0;
&&&&&&&&try {
&&&&&&&&&&&&writeBytes(b, off, len, append);
&&&&&&&&&&&&bytesWritten =
&&&&&&&&} finally {
&&&&&&&&&&&&IoTrace.fileWriteEnd(traceContext, bytesWritten);
&&&&publicvoidclose() throwsIOException {
&&&&&&&&synchronized(closeLock) {
&&&&&&&&&&&&if(closed) {
&&&&&&&&&&&&&&&&return;
&&&&&&&&&&&&}
&&&&&&&&&&&&closed = true;
&&&&&&&&if(channel != null) {
&&&&&&&&&&&&fd.decrementAndGetUseCount();
&&&&&&&&&&&&channel.close();
&&&&&&&&intuseCount = fd.decrementAndGetUseCount();
&&&&&&&&if((useCount &= 0) || !isRunningFinalize()) {
&&&&&&&&&&&&close0();
&&&&&public final FileDescriptor getFD()& throws IOException {
&&&&&&&&if(fd != null)
&&&&&&&&thrownewIOException();
&&&&publicFile Channel getChannel() {
&&&&&&&&synchronized(this) {
&&&&&&&&&&&&if(channel == null) {
&&&&&&&&&&&&&&&&channel = FileChannelImpl.open(fd, path, false, true, append, this);
&&&&&&&&&&&&&&&&fd.incrementAndGetUseCount();
&&&&&&&&&&&&}
&&&&&&&&&&&&
&&&&protected void finalize() throws IOException {
&&&&&&&&if(fd != null) {
&&&&&&&&&&&&if(fd == FileDescriptor.out || fd == FileDescriptor.err) {
&&&&&&&&&&&&&&&&flush();
&&&&&&&&&&&&} else{
&&&&&&&&&&&&&&&&runningFinalize.set(Boolean.TRUE);
&&&&&&&&&&&&&&&&try{
&&&&&&&&&&&&&&&&&&&&close();
&&&&&&&&&&&&&&&&} finally{
&&&&&&&&&&&&&&&&&&&&runningFinalize.set(Boolean.FALSE);
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
&&&&private native void close0() throws IOE
&&&&private static native void initIDs();
&&&&static{
&&&&&&&&initIDs();
1. 三个核心方法
三个核心方法,也就是Override(重写)了抽象类OutputStream的write方法。
void write(int b)&方法,即
public void write(intb) throws IOException
代码实现中很简单,一个try中调用本地native的write()方法,直接将指定的字节b写入文件输出流。IoTrace.fileReadEnd()的意思和上面FileInputStream意思一致。
void write(byte b[])&方法,即
public void write(byteb[]) throws IOException
代码实现也是比较简单的,也是一个try中调用本地native的writeBytes()方法,直接将指定的字节数组写入该文件输入流。
void write(byte b[], int off, int len)&方法,即
public void write(byte b[], int off, int len) throws IOException
代码实现和&void write(byte b[])&方法 一样,直接将指定的字节数组写入该文件输入流。
2. 值得一提的native方法
上面核心方法中为什么实现简单,因为工作量都在native方法里面,即JVM里面实现了。native倒是不少一一列举吧:
native void open(String name) // 打开文件,为了下一步读取文件内容
native void write(int b, boolean append) // 直接将指定的字节b写入文件输出流
native native void writeBytes(byte b[], int off, int len, boolean append) // 直接将指定的字节数组写入该文件输入流。
native void close0() // 关闭该文件输入流及涉及的资源,比如说如果该文件输入流的FileChannel对被获取后,需要对FileChannel进行close。
相似之处:
其实到这里,该想一想。两个源码实现很相似,而且native方法也很相似。其实不能说&相似&,应该以&对应&来概括它们。
它们是一组,是一根吸管的两个孔的关系:&一个Input一个Output&。
休息一下吧~ 看看小广告:
开源代码都在我的gitHub上哦 &&/JeffLi1993&作者留言&请手贱,点项目star,支持支持拜托拜托&
四、使用案例
下面先看代码:
packageorg.javacore.
importjava.io.F
importjava.io.FileInputS
importjava.io.FileOutputS
importjava.io.IOE
&* @author Jeff Lee
&* FileInputStream&FileOutputStream使用案例
public class FileIOStreamT {
&&&&private static final String thisFilePath =
&&&&&&&&&&&&"src"+ File.separator +
&&&&&&&&&&&&"org"+ File.separator +
&&&&&&&&&&&&"javacore"+ File.separator +
&&&&&&&&&&&&"io"+ File.separator +
&&&&&&&&&&&&"FileIOStreamT.java";
&&&&public static void main(String[] args) throws IOException {
&&&&&&&&FileInputStream fileInputStream = new FileInputStream(thisFilePath);
&&&&&&&&FileOutputStream fileOutputStream =& new FileOutputStream("data.txt");
&&&&&&&&&&
&&&&&&&&byte[] inOutBytes = new byte[fileInputStream.available()];
&&&&&&&&fileInputStream.read(inOutBytes);
&&&&&&&&fileOutputStream.write(inOutBytes);
&&&&&&&&&&
&&&&&&&&fileOutputStream.close();
&&&&&&&&fileInputStream.close();
运行后,会发现根目录中出现了一个&data.txt&文件,内容为上面的代码。
1. 简单地分析下源码:
1、创建了FileInputStream,读取该代码文件为文件输入流。
2、创建了FileOutputStream,作为文件输出流,输出至data.txt文件。
3、针对流的字节数组,一个 read ,一个write,完成读取和写入。
2. 代码调用的流程如图所示:
3. 代码虽简单,但是有点小问题:
FileInputStream.available() 是返回流中的估计剩余字节数。所以一般不会用此方法。
一般做法,比如创建一个 byte数组,大小1K。然后read至其返回值不为-1,一直读取即可。边读边写。
五、思考与小结
FileInputStream & FileOutputStream 是一对来自 InputStream和OutputStream的实现类。用于本地文件读写(二进制格式按顺序读写)。
本文小结:
1、FileInputStream 源码分析
2、FileOutputStream 资源分析
3、FileInputStream & FileOutputStream 使用案例
4、其源码调用过程
欢迎点击我的博客及GitHub & 博客提供RSS订阅哦!
&&&-&/&&&&&-&/JeffLi1993&&&&-
全能程序员交流QQ群,群内程序员都是来自,百度、阿里、京东、小米、去哪儿、饿了吗、蓝港等高级程序员 ,拥有丰富的经验。加入我们,直线沟通技术大牛,最佳的学习环境,了解业内的一手的资讯。如果你想结实大牛,那 就加入进来,让大牛带你超神!
相关搜索:
相关阅读:
相关频道:
&&&&&&&&&&&&&&&&
Java编程最近更新校花的偷心大盗最新章节(子龙威武&),校花的偷心大盗无弹窗广告全文阅读 - 要看书网
& 校花的偷心大盗最新章节列表
一个怕黑、胆小抑郁的十八岁高二学生龙晓宇,在经过催眠治疗后,知道自己的前世是明代天门山方丈上官云飞,在寻找过去的过程中,掉入地下溶洞,偶然开启了前世记忆,修炼出绝世武功和医术,回到学校后大放异彩,从此开始了充满艳遇、精彩纷呈的新生活。校花、美女老师、警花、美女老总、极品少妇、小萝莉等纷纷登场,本书为您呈现了暧昧香艳、风光旖旎的yy大餐!
新书上传需要大家的支持,推荐、收藏、会员点击全向我砸来吧!
各位书友要是觉得《校花的偷心大盗》还不错的话请不要忘记向您QQ群和微博里的朋友推荐哦!
推荐阅读:
《校花的偷心大盗》正文

我要回帖

更多关于 勤奋自学成大器ppt 的文章

 

随机推荐