CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - INT 1
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Sub Category
Network Marketing
Management
E-commerce
Business guide
Business plan
Successful incentive
Human Resources
Report papers
Marketing materials
Consulting and training
Website
Software Engineering
File Format
Technology Management
Industry research
Program doc
Other
Search - INT 1 - List
[
Documents
]
javaNIO
DL : 0
一系列缓冲区类支撑起了 Java 2 平台标准版的新 I/O(NIO)包。这些类的数据容器形成了其它 NIO 操作(如套接字通道上的非阻塞读取)的基础。在本月的 Merlin 的魔力中,常驻 Java 编程专家 John Zukowski 展示了如何操作那些数据缓冲区来执行如读/写原语这样的任务以及如何使用内存映射文件。在以后的文章里,他将把这里所提到的概念扩展到套接字通道的使用。 Java 2 平台标准版(Java 2 Platform Standard Edition,J2SE)1.4 对 Java 平台的 I/O 处理能力做了大量更改。它不仅用流到流的链接方式继续支持以前 J2SE 发行版的基于流的 I/O 操作,而且 Merlin 还添加了新的功能 — 称之为新 I/O 类(NIO),现在这些类位于 java.nio 包中。 I/O 执行输入和输出操作,将数据从文件或系统控制台等传送至或传送出应用程序。(有关 Java I/O 的其它信息,请参阅 参考资料)。 缓冲区基础 抽象的 Buffer 类是 java.nio 包支持缓冲区的基础。 Buffer的工作方式就象内存中用于读写基本数据类型的 RandomAccessFile 。象 RandomAccessFile一样,使用 Buffer ,所执行的下一个操作(读/写)在当前某个位置发生。执行这两个操作中的任一个都会改变那个位置,所以在写操作之后进行读操作不会读到刚才所写的内容,而会读到刚才所写内容之后的数据。 Buffer 提供了四个指示方法,用于访问线性结构(从最高值到最低值): "capacity() :表明缓冲区的大小 "limit() :告诉您到目前为止已经往缓冲区填了多少字节,或者让您用 :limit(int newLimit) 来改变这个限制 "position() :告诉您当前的位置,以执行下一个读/写操作 "mark() :为了稍后用 reset() 进行重新设置而记住某个位置 缓冲区的基本操作是 get() 和 put() ;然而,这些方法在子类中都是针对每种数据类型的特定方法。为了说明这一情况,让我们研究一个简单示例,该示例演示了从同一个缓冲区读和写一个字符。在清单 1 中, flip() 方法交换限制和位置,然后将位置置为 0,并废弃标记,让您读刚才所写的数据: 清单 1. 读/写示例 import java.nio.*; ... CharBuffer buff = ...; buff.put('A'); buff.flip(); char c = buff.get(); System.out.println("An A: " + c); 现在让我们研究一些具体的 Buffer 子类。 回页首 缓冲区类型 Merlin 具有 7 种特定的 Buffer 类型,每种类型对应着一个基本数据类型(不包括 boolean): "ByteBuffer "CharBuffer "DoubleBuffer "FloatBuffer "IntBuffer "LongBuffer "ShortBuffer 在本文后面,我将讨论第 8 种类型 MappedByteBuffer ,它用于内存映射文件。如果您必须使用的类型不是这些基本类型,则可以先从 ByteBuffer 获得字节类型,然后将其转换成 Object 或其它任何类型。 正如前面所提到的,每个缓冲区包含 get() 和 put() 方法,它们可以提供类型安全的版本。通常,需要重载这些 get() 和 put() 方法。例如,有了 CharBuffer ,可以用 get() 获得下一个字符,用 get(int index) 获得某个特定位置的字符,或者用 get(char[] destination) 获得一串字符。静态方法也可以创建缓冲区,因为不存在构造函数。那么,仍以 CharBuffer为例,用 CharBuffer.wrap(aString) 可以将 String对象转换成 CharBuffer 。为了演示,清单 2 接受第一个命令行参数,将它转换成 CharBuffer ,并显示参数中的每个字符: 清单 2. CharBuffer 演示 import java.nio.*; public class ReadBuff { public static void main(String args[]) { if (args.length != 0) { CharBuffer buff = CharBuffer.wrap(args[0]); for (int i=0, n=buff.length(); i<n; i++) { System.out.println(i + " : " + buff.get()); } } } } 请注意,这里我使用了 get() ,而没有使用 get(index) 。我这样做的原因是,在每次执行 get() 操作之后,位置都会移动,所以不需要手工来声明要检索的位置。 回页首 直接 vs. 间接 既然已经了解了典型的缓冲区,那么让我们研究直接缓冲区与间接缓冲区之间的差别。在创建缓冲区时,可以要求创建直接缓冲区,创建直接缓冲区的成本要比创建间接缓冲区高,但这可以使运行时环境直接在该缓冲区上进行较快的本机 I/O 操作。因为创建直接缓冲区所增加的成本,所以直接缓冲区只用于长生存期的缓冲区,而不用于短生存期、一次性且用完就丢弃的缓冲区。而且,只能在 ByteBuffer 这个级别上创建直接缓冲区,如果希望使用其它类型,则必须将 Buffer 转换成更具体的类型。为了演示,清单 3 中代码的行为与清单 2 的行为一样,但清单 3 使用直接缓冲区: 清单 3. 列出网络接口 import java.nio.*; public class ReadDirectBuff { public static void main(String args[]) { if (args.length != 0) { String arg = args[0]; int size = arg.length(); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(size*2); CharBuffer buff = byteBuffer.asCharBuffer(); buff.put(arg); buff.rewind(); for (int i=0, n=buff.length(); i<n; i++) { System.out.println(i + " : " + buff.get()); } } } } 在上面的代码中,请注意,不能只是将 String 包装在直接 ByteBuffer中。必须首先创建一个缓冲区,先填充它,然后将位置倒回起始点,这样才能从头读。还要记住,字符长度是字节长度的两倍,因此示例中会有 size*2 。 回页首 内存映射文件 第 8 种 Buffer 类型 MappedByteBuffer 只是一种特殊的 ByteBuffer 。 MappedByteBuffer 将文件所在区域直接映射到内存。通常,该区域包含整个文件,但也可以只映射部分文件。所以,必须指定要映射文件的哪部分。而且,与其它 Buffer 对象一样,这里没有构造函数;必须让 java.nio.channels.FileChannel的 map() 方法来获取 MappedByteBuffer 。此外,无需过多涉及通道就可以用 getChannel() 方法从 FileInputStream 或 FileOutputStream获取 FileChannel 。通过从命令行传入文件名来读取文本文件的内容,清单 4 显示了 MappedByteBuffer : 清单 4. 读取内存映射文本文件 import java.io.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*; public class ReadFileBuff { public static void main(String args[]) throws IOException { if (args.length != 0) { String filename = args[0]; FileInputStream fis = new FileInputStream(filename); FileChannel channel = fis.getChannel(); int length = (int)channel.size(); MappedByteBuffer byteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, length); Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); CharBuffer charBuffer = decoder.decode(byteBuffer); for (int i=0, n=charBuffer.length(); i<n; i++) { System.out.print(charBuffer.get()); } } } }
Date
: 2010-09-20
Size
: 5.74kb
User
:
635868631@qq.com
[
Documents
]
大作业 3
DL : 0
这是一个关于98I/O结构的文档,主要分析了int 16h及int 14中的主要部分- This is about the 98I/O structure documents, mainly has analyzed int 16h and the int 14 center main part
Date
: 2026-01-05
Size
: 12kb
User
:
小猪
[
Documents
]
CANNY 算子
DL : 0
int trace (int i, int j, int low, IMAGE im,IMAGE mag, IMAGE ori) float gauss(float x, float sigma) float dGauss (float x, float sigma) float meanGauss (float x, float sigma) void hysteresis (int high, int low, IMAGE im, IMAGE mag, IMAGE oriim) void canny (float s, IMAGE im, IMAGE mag, IMAGE ori)
Date
: 2026-01-05
Size
: 3kb
User
:
呼怀平
[
Documents
]
waveOCXn
DL : 0
< 波形声音控件函数使用说明>> ****************************************************************************************************************** 函数名 功能 说明 ------------------------------------------------------------------------------------------------------------------ GetData() 获取评分数据 当调用GetData()时WVGetData事件会自动 触发,参数Data也就是得到的数据 GetLength() 获取文件总长度 函数返回文件的长度 OpenFile(CString filename) 打开声音文件自 动分析波形 RECPFstart(long Max) 长度限制录制 当录制的长度大于Max时自动停止,并返回 RECPFstop事件 RECstart() 开始录音 RECstop() 停止录音 RECpause(bool REC_STATE) 继续/暂停录音 当REC_STATEO为TRUE时暂停有效,相反继续 play() 播放 replay(int dounum) 重复播放 dounum为重复次数 pause() 暂停 stop() 停止播放-lt; Lt; Waveform voice control function for use gt; Gt;********************************************************************************************************************** function Description------------------------------------------------------------------------------------------------------------------ GetData () were When the score data from call GetData () WVGetData incident will automatically trigger, parameters Data is the data GetLength () access to documents total length function returns the length OpenFile (redeem filename) to open the audio files automatically waveform analysis RECPFstart (long Max) was recorded when the recording length restriction the system is greater than the length of Max automatically stop, and return to RECPFstop incident RECstart () began recordi
Date
: 2026-01-05
Size
: 12kb
User
:
代振生
[
Documents
]
汇编语言课程设计1
DL : 0
程序首先定义一个hello的函数调用int 21h mov ah ,09来显示字符串,ds:dx定义字符串位置 来使用一个80×25的界面使整个程序更加美观 游戏主程序调用BIOS int 10 的9号功能实现对目标文本的颜色和定位,。游戏主程序可以用int 16 mov ah,00从键盘读取输入的字符在调用int 21 mov ah,01 让键盘输入显示在屏幕中 al=输入的字符,用cmp指令对输入的文本和目标文本进行比较,再利用选择语句将错误的输入字符显示为红色,将正确的输入字符显示为绿色。在整个字符串结束后直接退到dos环境-procedures hello first definition of a function call int 21 hours mov ah, 09 to show string, ds : dx definition string position to use a 80 x 25 interface to make the whole process more attractive game int main program called BIOS on the 9th of 10 functions to achieve the goal of text color and positioning. Game int main program can use 16 mov ah, 00 input from the keyboard to read characters in the call int 21 mov ah, 01 for keyboard input the screen were al = input characters using cmp directive of input text and the text more goals and used the wrong choice of words to the imported characters shown as red, to the correct input characters shown as green. The entire string after the end of direct retreated dos environment
Date
: 2026-01-05
Size
: 11kb
User
:
高赈寰
[
Documents
]
c语言教程(www.vcok.com版)
DL : 2
经典c程序100例==1--10 【程序1】 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? 1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去 掉不满足条件的排列。 2.程序源代码: main() { int i,j,k printf("\n") for(i=1 i<5 i++) /*以下为三重循环*/ for(j=1 j<5 j++) for (k=1 k<5 k++) { if (i!=k&&i!=j&&j!=k) /*确保i、j、k三位互不相同*/ printf("%d,%d,%d\n",i,j,k) }-classic procedures hundred cases == 1-- 10 procedures-- a topic : 1,2,3,4 figures, the number can be formed with each other with no repeat of the triple-digit figures? How many are? 1. Program Analysis : can fill the 100, 10, 000 the number of spaces are 1,2,3,4. With all the components removed after not satisfied with the conditions. 2. Source code : main () (int i, j, k printf ( "\ n") for (i = 1 ilt; 5 i)/* the following as the triple cycle*/for (j = 1 JLT; 5 j) for (k = 1 KLT; 5 k) (if (i! = ki! = jj! = k)/* i, j, k three disparate*/printf ( "% d,% d,% d \ n ", i, j, k
Date
: 2026-01-05
Size
: 297kb
User
:
刘宋
[
Documents
]
硬盘结构简介
DL : 0
Date
: 2026-01-05
Size
: 10kb
User
:
安辉
[
Documents
]
INT13
DL : 0
int13技术文档,供对磁盘直接读取编程使用-int13 technical documentation for the right disk read directly using programming
Date
: 2026-01-05
Size
: 8kb
User
:
陈建林
[
Documents
]
int10h
DL : 0
int 10h 介绍系统功能调用 -introduced the system int 10h function calls
Date
: 2026-01-05
Size
: 11kb
User
:
田基
[
Documents
]
wenzhouxueyuan
DL : 0
#include <stdio.h> #include <stdlib.h> #define OK 1 #define OVERFLOW -2 typedef int status typedef struct LinkList{ //用带表头结点的有序链表表示多项式 float coef //系数 int expn //指数 struct LinkList *next //指向后继的指针 }*polynomail //结构体类型的指针-# Include <stdio.h># Include <stdlib.h># Define OK 1# Define OVERFLOW-2typedef int status typedef struct LinkList (//use with header node list in an orderly manner that the polynomial float coef// coefficient int expn// index struct LinkList* next// point subsequent pointer)* polynomail// structure type of pointer
Date
: 2026-01-05
Size
: 33kb
User
:
周小强
[
Documents
]
RemoteDataAcquisitionControlandAnalysisusingLabvie
DL : 0
《Remote Data Acquisition, Control and Analysis using LabVIEW Front Panel and Real Time Engine》 Swain, N.K. Anderson, J.A. Ajit Singh Swain, M. Fulton, M. Garrett, J. Tucker, O. SoutheastCon, 2003. Proceedings. IEEE 4-6 April 2003 Page(s):1 - 6 Digital Object Identifier 10.1109/SECON.2003.1268423 Summary: Students and faculty from South Carolina State University (SCSU) are collaborating with the staff at the Pisgah Astronomical Research Institute (PARI) to allow the SMILEY radio telescope to be accessed and controlled over the SCSU Network and the Int-《Remote Data Acquisition, Control and Analysis using LabVIEW Front Panel and Real Time Engine》 Swain, N.K. Anderson, J.A. Ajit Singh Swain, M. Fulton, M. Garrett, J. Tucker, O. SoutheastCon, 2003. Proceedings. IEEE 4-6 April 2003 Page(s):1- 6 Digital Object Identifier 10.1109/SECON.2003.1268423 Summary: Students and faculty from South Carolina State University (SCSU) are collaborating with the staff at the Pisgah Astronomical Research Institute (PARI) to allow the SMILEY radio telescope to be accessed and controlled over the SCSU Network and the Int.....
Date
: 2026-01-05
Size
: 359kb
User
:
boyang
[
Documents
]
csxj
DL : 0
定义一个名为Integer的类,具有数据成员d,成员函数GetD()获取d的值,SetD(int)设置d的值,IsOdd()判断d是否为偶数,IsPrime()判断d是否为一个素 数,并设计主函数用一个对象分别设置d的值为15和31,测试这个类 -, and to design the main function of an object with the value of d were set to 15 and 31, to test the class
Date
: 2026-01-05
Size
: 12kb
User
:
张尧林
[
Documents
]
ResearchofForwardLinearPredictiononProcessingofSil
DL : 0
介绍了前向线性预测滤波算法的基本原理,提出了一种自适应滤波过程中各参数的确定方法,对某硅微陀螺的静态 漂移信号和实际动态信号进行了处理,给出了静态漂移信号滤波前后的Allan 方差和标准差的大小,对滤波前后的误差大小 和误差分布进行了分析,并与小波中值滤波效果进行了比较。结果表明,前向线性预测滤波方法无论是在去噪效果,还是实 时性等方面,都明显优于小波中值滤波-Principle of t he forward linear prediction ( FL P) is int roduced. How to destine all parameter s of t he FL P by an adaptive met hod is given. A silicon gyroscope static drif t and t he dynamic measurement is processed by FL P. The Allan variance and t he standard variance is used to compare t he filtering result . The error and it s dist ribution is listed. The FL P is compared with t he median2wavelet filtering. The result shows t hat the FL P is superior to t he median2wavelet in the de2noise effect and real2time and so on.
Date
: 2026-01-05
Size
: 328kb
User
:
qulidan
[
Documents
]
program
DL : 0
实现c语言的词法分析器,用文件读取,要求能识别整数、自定义标识符及以下关键字: + - * / < <= == != > >= & && || = ( ) [ ] { } : , void int float char if else while do ! main -Achieve c language lexical analyzer, using file read, the request can identify integers, custom identifiers and the following keywords:+-*/< < = ==! => > = & & & | | = () [] (): , void int float char if else while do! main
Date
: 2026-01-05
Size
: 2kb
User
:
孔秀平
[
Documents
]
1
DL : 0
在函数中进行10个学生成绩从高到低排名 sort(int a[10])-In the function for 10 pupils from high to low ranking sort (int a [10])
Date
: 2026-01-05
Size
: 1kb
User
:
huangkb
[
Documents
]
1
DL : 0
int N TColor curcolor POINT Points[40] float berstein(int n,int k,float t) { float c int j if((k==0)||(k==n)) c=1 else { c=1 for(j=1,j<k j++) c=(c*(n+1-j))/j } if(((t==0)&&(k==0)))||(((t==1)&&(k==n))) return c else { for(j=1 j<=k j++) c=c*t for(j=1 j<n-k j++) c=c*(1-t) return c } }
Date
: 2026-01-05
Size
: 3kb
User
:
lu
[
Documents
]
01259361tubianlideyanshi
DL : 0
图的遍历的演示(c 语言 数据结构课程设计题) /*定义图*/ typedef struct{ int V[M] int R[M][M] int vexnum }Graph /*创建图*/ void creatgraph(Graph *g,int n) { int i,j,r1,r2 g->vexnum=n /*顶点用i表示*/ for(i=1 i<=n i++) { g->V[i]=i } /*初始化R*/ for(i=1 i<=n i++) for(j=1 j<=n j++) { g->R[i][j]=0 } /*输入R*/ printf("Please input R(0,0 END):\n") scanf("%d,%d",&r1,&r2) while(r1!=0&&r2!=0) { g->R[r1][r2]=1 g->R[r2][r1]=1 scanf("%d,%d",&r1,&r2) } } -graph traversal of the display (c language curriculum design data structures that)/* definition of the map*/typedef s truct V (int int [M] R [M] [M]) int vexnum Graph/* create map*/void creatgraph (Graph* g, int n) (int i, j, r1, r2 g--Graph traversal of the presentation (c language data structure, curriculum design issues) /* definition of map*/typedef struct (int V [M] int R [M] [M] int vexnum) Graph /* create the map*/void creatgraph (Graph* g, int n) (int i, j, r1, r2 g-> vexnum = n /* vertex with i said*/for (i = 1 i < = n i++) (g-> V [i] = i ) /* initialize the R*/for (i = 1 i < = n i++) for (j = 1 j < = n j++) (g-> R [i] [j] = 0) /* input R*/printf (" Please input R (0,0 END): \ n" ) scanf (" d, d" , & r1, & r2) while (r1! = 0 & & r2! = 0) (g-> R [r1] [r2] = 1 g-> R [r2] [r1] = 1 scanf (" d, d" , & r1, & r2)))-graph traversal of the display (c language curriculum design data structures that) /* definition of the map*/typedef s truct V (int int [M] R [M] [M]) int vexnum Graph /* create map*/void creatgraph (Graph* g, int n) (int i, j, r1 , r2 g-
Date
: 2026-01-05
Size
: 59kb
User
:
唐钊
[
Documents
]
C大整数加法
DL : 0
c语言大整数加法,超大整数,超出int默认最大值(C language large integer addition, large integer, beyond int default maximum)
Date
: 2026-01-05
Size
: 1kb
User
:
N1neSun
[
Documents
]
1203
DL : 0
Input Format 输入文件包括四行。 第一行包括一个字符串,有三种情况:int、char、double,代表线性表的类型。 第二行包括两个正整数n,m. (1<=n,m<=10000) 第三行包括n个用空格分开的数据,内容可能是整形,浮点或者字符,由第一行的内容决定,代表第一个线性表的元素。 第四行包括m个用空格分开的数据,内容可能是整形,浮点或者字符,由第一行的内容决定,代表第二个线性表的元素。 Output Format 输出文件包括一行内容,其中每个数据用空格隔开,代表合并后线性表的元素。(combine two linklist to one together)
Date
: 2026-01-05
Size
: 182kb
User
:
alpha_alpha
[
Documents
]
ToMap
DL : 0
public static Map<String, Object> ObjectToMapUtil(Object obj){ Map<String,Object> reMap = new HashMap<String,Object>(); Field[] fields = obj.getClass().getDeclaredFields(); for(int i = 0; i < fields.length; i++){ Field subField = obj.getClass().getDeclaredField(fields[i].getName()); subField.setAccessible(true); Object o = subField.get(info); reMap.put(fields[i].getName(), o); } return reMap; }(I hope I can help you.json to map.)
Date
: 2026-01-05
Size
: 1kb
User
:
少郎
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.