Topic: .write()括号中看不懂

  Print this page

1..write()括号中看不懂 Copy to clipboard
Posted by: simule
Posted on: 2005-04-20 20:30

.write()括号中参数什么意思?3者有什么关系?刚学不久看不懂.谢谢
比如有下面个程序段
Static void copyContent (FileInputStream inObj,FileOutputStream outObj)
{
int copyLen;
byte[] copyBut= new byte[1024];
try{
while((copyLen=inObj.read(copyBut,0,1024))!=-1){
String copyStr=new Srting(copyBut);
System.out.println(copyStr);
outObj.write(copyBut,0,copyLen);
}
}

最后outObj.write(copyBut,0,copyLen)括号中3参数什么意思?

2.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: why
Posted on: 2005-04-20 20:49

Please check the Java API in the future.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.html#write(byte[],%20int,%20int)

write
public void write(byte[] b,
int off,
int len)
throws IOExceptionWrites len bytes from the specified byte array starting at offset off to this file output stream.

Overrides:
write in class OutputStream

Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.

Throws:
IOException - if an I/O error occurs.

3.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: simule
Posted on: 2005-04-21 08:40

看不懂这句 the start offset in the data.
斑竹解释下

4.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: why
Posted on: 2005-04-21 08:58

offset ~ position
start offset ~ starting position

write "len" bytes of data "b", starting from position "off", to the FileOutputStream instance

5.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: simule
Posted on: 2005-04-22 09:04

我懂了,谢谢斑竹
还有个问题:
media包里有哪些类,各有什么用?你上面给我的网站不知道有没有,不过还是得去看看.

6.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: why
Posted on: 2005-04-22 09:36

simule wrote:
media包里有哪些类,各有什么用?你上面给我的网站不知道有没有,不过还是得去看看.

What is media 包?
Java Media Framework API (JMF)?
http://java.sun.com/products/java-media/jmf/

http://java.sun.com/products/java-media/jmf/2.1.1/download.html

7.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: simule
Posted on: 2005-04-24 13:49

我说的是JEME中Media包里中的类,要声音处理不知道用哪个类

8.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: why
Posted on: 2005-04-24 19:17

J2ME中的Media包???? What is it?
Mobile Media API, MMAPI, JSR 135 ???

Please make a new post on our J2ME board.

9.Re:.write()括号中看不懂 [Re: simule] Copy to clipboard
Posted by: simule
Posted on: 2005-04-26 20:33

I have made a new post on J2ME board.
I'm a new learner,I am preciate to everyone who can help me.Thank you.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923