首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

InputStream与DataInputStream的差别

2011-12-18 
InputStream与DataInputStream的区别!如题...DataInputStream是InputStream的子类....为什么有时候用这个,

InputStream与DataInputStream的区别!
如题...

DataInputStream是InputStream的子类....

为什么有时候用这个,有时候用那个??

[解决办法]
一个是实体类,一个是抽像类
[解决办法]
DataInputStream类继承了InputStream,同是实现了DataInput接口,也就是说比普通的InputStream多一些方法。
增加方法如下:

public abstract void readFully(byte abyte0[])
throws IOException;

public abstract void readFully(byte abyte0[], int i, int j)
throws IOException;

public abstract int skipBytes(int i)
throws IOException;

public abstract boolean readBoolean()
throws IOException;

public abstract byte readByte()
throws IOException;

public abstract int readUnsignedByte()
throws IOException;

public abstract short readShort()
throws IOException;

public abstract int readUnsignedShort()
throws IOException;

public abstract char readChar()
throws IOException;

public abstract int readInt()
throws IOException;

public abstract long readLong()
throws IOException;

public abstract float readFloat()
throws IOException;

public abstract double readDouble()
throws IOException;

public abstract String readUTF()
throws IOException;

热点排行