public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl implements ImageOutputStream
ImageOutputStream
。这个类的设计是为了减少必须由子类来实现的方法的数量。
bitOffset, byteOrder, flushedPos, streamPos
Constructor and Description |
---|
ImageOutputStreamImpl()
构建了一个
ImageOutputStreamImpl 。
|
Modifier and Type | Method and Description |
---|---|
protected void |
flushBits()
如果位偏移是非零,则将当前字节中的剩余位强制为0,并用一个。
|
void |
write(byte[] b)
将一个字节序列写入当前位置的流中。
|
abstract void |
write(byte[] b, int off, int len)
将一个字节序列写入当前位置的流中。
|
abstract void |
write(int b)
在当前位置写入一个字节到流。
|
void |
writeBit(int bit)
写入由至少有意义的参数的一个位,在当前字节位置的当前位偏移量的流中。
|
void |
writeBits(long bits, int numBits)
写一个序列的比特,在剩下的
bits 论点的
numBits 最低有效位给予正确的顺序,以流现位偏移在当前字节位置。
|
void |
writeBoolean(boolean v)
写一个
boolean 价值流。
|
void |
writeByte(int v)
写
v 8低阶比特流。
|
void |
writeBytes(String s)
将字符串写入到输出流中。
|
void |
writeChar(int v)
这个方法是一个同义词
writeShort 。
|
void |
writeChars(char[] c, int off, int len)
写一个字符序列到流中的当前位置。
|
void |
writeChars(String s)
将字符串写入到输出流中。
|
void |
writeDouble(double v)
写一个
double 值,它是由四个字节,到输出流。
|
void |
writeDoubles(double[] d, int off, int len)
将一个序列的一个序列写入当前位置的流中。
|
void |
writeFloat(float v)
写一个
float 值,它是由四个字节,到输出流。
|
void |
writeFloats(float[] f, int off, int len)
在当前位置上写一个浮点到流的序列。
|
void |
writeInt(int v)
写32位
v 到流。
|
void |
writeInts(int[] i, int off, int len)
写一个整数序列流的当前位置。
|
void |
writeLong(long v)
写64位
v 到流。
|
void |
writeLongs(long[] l, int off, int len)
在当前位置写一个对流的序列。
|
void |
writeShort(int v)
写
v 16低阶比特流。
|
void |
writeShorts(short[] s, int off, int len)
在当前位置上写入流的一系列短片。
|
void |
writeUTF(String s)
写两个字节长度的信息在网络字节顺序输出流,其次是字符串中的每个字符的
modified UTF-8表示
s 。
|
checkClosed, close, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flushBefore
close, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
public ImageOutputStreamImpl()
ImageOutputStreamImpl
。
public abstract void write(int b) throws IOException
ImageOutputStream
b
24阶位被忽略。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。实施者可以使用的方法来保证这ImageOutputStreamImpl
flushBits
。
write
接口
DataOutput
write
接口
ImageOutputStream
b
-
int
的低8位都要写。
IOException
如果I/O错误发生。
public void write(byte[] b) throws IOException
ImageOutputStream
b.length
是0,什么都不写。字节
b[0]
是第一次写,然后
b[1]
字节,等等。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
write
接口
DataOutput
write
接口
ImageOutputStream
b
-
byte
s被写入数组。
IOException
如果I/O错误发生。
public abstract void write(byte[] b, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。字节
b[off]
是第一次写,然后
b[off + 1]
字节,等等。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。实施者可以使用的方法来保证这ImageOutputStreamImpl
flushBits
。
write
接口
DataOutput
write
接口
ImageOutputStream
b
-
byte
s被写入数组。
off
的起始偏移量的数据。
len
-
byte
s数写。
IOException
如果I/O错误发生。
public void writeBoolean(boolean v) throws IOException
ImageOutputStream
boolean
价值流。如果
v
是真的,价值
(byte)1
写;如果
v
是假的,价值
(byte)0
写。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeBoolean
接口
DataOutput
writeBoolean
接口
ImageOutputStream
v
-
boolean
要写。
IOException
如果I/O错误发生。
public void writeByte(int v) throws IOException
ImageOutputStream
v
8低阶比特流。对
v
24阶位被忽略。(这意味着
writeByte
做同样的事情作为一个整型参数。
write
)
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeByte
接口
DataOutput
writeByte
接口
ImageOutputStream
v
-
int
包含字节值写入。
IOException
如果I/O错误发生。
public void writeShort(int v) throws IOException
ImageOutputStream
v
16低阶比特流。对
v
16阶位被忽略。如果流使用网络字节顺序,字节写的,为了将:
(字节)((V > > 8)& 0xff)(字节)(V & 0xff)否则,字节写的将是:
(字节)(V & 0xff)(字节)((V > > 8)& 0xff)
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeShort
接口
DataOutput
writeShort
接口
ImageOutputStream
v
-
int
含有短值被写入。
IOException
如果I/O错误发生。
public void writeChar(int v) throws IOException
ImageOutputStream
writeShort
。
writeChar
接口
DataOutput
writeChar
接口
ImageOutputStream
v
-
int
含炭(unsigned short)写入值。
IOException
如果I/O错误发生。
ImageOutputStream.writeShort(int)
public void writeInt(int v) throws IOException
ImageOutputStream
v
到流。如果流使用网络字节顺序,字节写的,为了将:
(字节)((V > > 24)& 0xff)(字节)((V > > 16)& 0xff)(字节)((V > > 8)& 0xff)(字节)(V & 0xff)otheriwse,字节写的将是:
(字节)(V & 0xff)(字节)((V > > 8)& 0xff)(字节)((V > > 16)& 0xff)(字节)((V > > 24)& 0xff)
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeInt
接口
DataOutput
writeInt
接口
ImageOutputStream
v
-
int
含有值被写入。
IOException
如果I/O错误发生。
public void writeLong(long v) throws IOException
ImageOutputStream
v
到流。如果流使用网络字节顺序,字节写的,为了将:
(字节)((V > > 56)& 0xff)(字节)((V > > 48)& 0xff)(字节)((V > > 40)& 0xff)(字节)((V > > 32)& 0xff)(字节)((V > > 24)& 0xff)(字节)((V > > 16)& 0xff)(字节)((V > > 8)& 0xff)(字节)(V & 0xff)否则,字节写的将是:
(字节)(V & 0xff)(字节)((V > > 8)& 0xff)(字节)((V > > 16)& 0xff)(字节)((V > > 24)& 0xff)(字节)((V > > 32)& 0xff)(字节)((V > > 40)& 0xff)(字节)((V > > 48)& 0xff)(字节)((V > > 56)& 0xff)
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeLong
接口
DataOutput
writeLong
接口
ImageOutputStream
v
-
long
含有值被写入。
IOException
如果I/O错误发生。
public void writeFloat(float v) throws IOException
ImageOutputStream
float
值,它是由四个字节,到输出流。它好像一把这
float
值的方法是
Float.floatToIntBits
方式
int
然后写int值的方法是
writeInt
方式。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeFloat
接口
DataOutput
writeFloat
接口
ImageOutputStream
v
-
float
含有值被写入。
IOException
如果I/O错误发生。
public void writeDouble(double v) throws IOException
ImageOutputStream
double
值,它是由四个字节,到输出流。它好像一把这
double
值的方法是
Double.doubleToLongBits
方式
long
然后写长值准确的
writeLong
方法的方式。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeDouble
接口
DataOutput
writeDouble
接口
ImageOutputStream
v
-
double
含有值被写入。
IOException
如果I/O错误发生。
public void writeBytes(String s) throws IOException
ImageOutputStream
s
,以,一个字节被写入输出流。如果
s
是
null
,一
NullPointerException
抛出。
如果s.length
是零,那么没有字节被写入。否则,性格s[0]
是第一次写,然后s[1]
,等等;最后一个字符是s[s.length-1]
。对每个字符一个字节写,低字节,在准确的writeByte
方法的方式。字符串中的每个字符的高阶八位被忽略。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeBytes
接口
DataOutput
writeBytes
接口
ImageOutputStream
s
-
String
含有值被写入。
IOException
如果I/O错误发生。
public void writeChars(String s) throws IOException
ImageOutputStream
s
,以,两个字节写入到输出流,下令按字节顺序设置。如果正在使用网络字节顺序,高阶字节是先写的;顺序相反,否则。如果
s
是
null
,一
NullPointerException
抛出。
如果s.length
是零,那么没有字节被写入。否则,性格s[0]
是第一次写,然后s[1]
,等等;最后一个字符是s[s.length-1]
。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeChars
接口
DataOutput
writeChars
接口
ImageOutputStream
s
-
String
含有值被写入。
IOException
如果I/O错误发生。
public void writeUTF(String s) throws IOException
ImageOutputStream
s
。如果
s
是
null
,一
NullPointerException
抛出。字符串中的每个字符
s
转换为一组一个,两个,或三个字节,根据角色的价值。
如果一个角色c
范围在\u0001
通过\u007f
,它是由一个字节表示:
(字节)
如果一个角色c
是\u0000
或范围在\u0080
通过\u07ff
,那么它是由两个字节来表示,是用以证明:
(byte)(0xc0 | (0x1f & (c >> 6)))
(byte)(0x80 | (0x3f & c))
如果一个角色c
范围在\u0800
通过uffff
,然后用三个字节来表示,是用显示的顺序:
(byte)(0xe0 | (0x0f & (c >> 12)))
(byte)(0x80 | (0x3f & (c >> 6)))
(byte)(0x80 | (0x3f & c))
首先,需要代表s
所有人物的总字节数的计算。如果这个数字大于65535
,然后UTFDataFormatException
抛出。否则,这个长度是在完全的writeShort
方法方式的写入输出流;在这之后,一个,两个,或字符串中的每个字符三个字节表示s
写。
当前字节顺序设置被忽略。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
注:此方法不能用于图像格式,使用标准的UTF-8的实施,因为修改UTF-8用在这里是标准的UTF-8不相容。
writeUTF
接口
DataOutput
writeUTF
接口
ImageOutputStream
s
-
String
含有值被写入。
UTFDataFormatException
-如果
s
UTF-8需要超过65536字节。
IOException
如果I/O错误发生。
public void writeShorts(short[] s, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。短
s[off]
是第一次写,那么短的
s[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeShorts
接口
ImageOutputStream
s
-
short
s被写入数组。
off
的起始偏移量的数据。
len
-
short
s数。
IOException
如果I/O错误发生。
public void writeChars(char[] c, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。焦炭
c[off]
是第一次写,然后焦
c[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeChars
接口
ImageOutputStream
c
-
char
s被写入数组。
off
的起始偏移量的数据。
len
-
char
s数写。
IOException
如果I/O错误发生。
public void writeInts(int[] i, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。int
i[off]
是第一次写,然后在
i[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeInts
接口
ImageOutputStream
i
-
int
s被写入数组。
off
的起始偏移量的数据。
len
-
int
s数写。
IOException
如果I/O错误发生。
public void writeLongs(long[] l, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。长
l[off]
是第一次写,那么长的
l[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeLongs
接口
ImageOutputStream
l
-
long
s被写入数组。
off
的起始偏移量的数据。
len
-
long
s数写。
IOException
如果I/O错误发生。
public void writeFloats(float[] f, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。浮
f[off]
是第一次写,然后浮
f[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeFloats
接口
ImageOutputStream
f
-
float
s被写入数组。
off
的起始偏移量的数据。
len
-
float
s数写。
IOException
如果I/O错误发生。
public void writeDoubles(double[] d, int off, int len) throws IOException
ImageOutputStream
len
是0,什么都不写。双
d[off]
是第一次写,然后双
d[off + 1]
,等等。流的字节顺序是用来确定单个字节的写入顺序的。
如果在流偏位非零,其余的当前字节填充0和写了第一。写入后的位偏移量将为0。
writeDoubles
接口
ImageOutputStream
d
-
doubles
s被写入数组。
off
-在数据的起始偏移量。
len
-
double
s数写。
IOException
如果I/O错误发生。
public void writeBit(int bit) throws IOException
ImageOutputStream
如果一个特定字节的任何位从来没有被设置在时间的字节被刷新到目的地,这些位将被设置为0自动。
writeBit
接口
ImageOutputStream
bit
-
int
其最低有效位被写入到流。
IOException
如果I/O错误发生。
public void writeBits(long bits, int numBits) throws IOException
ImageOutputStream
bits
论点的
numBits
最低有效位给予正确的顺序,以流现位偏移在当前字节位置。这个论点上
64 - numBits
位忽略。位偏移是先进的
numBits
降低模8。请注意,0的位偏移量总是表示字节的最显着的位,和字节的位写在序列中,因为它们遇到。因此,位写入总是有效地在网络字节序。将忽略实际的流字节顺序设置。
位数据可以存储在存储器中下去,直到flushBefore
叫做。在那个时候,刷新位置之前的所有位数据将被写入。
如果一个特定字节的任何位从来没有被设置在时间的字节被刷新到目的地,这些位将被设置为0自动。
writeBits
接口
ImageOutputStream
bits
-
long
含位来写的,从位置
numBits - 1
降到最低有效位的位。
numBits
- 0和64之间的一个
int
,包容。
IOException
如果I/O错误发生。
protected final void flushBits() throws IOException
write(int)
和
write(byte[], int, int)
方法开始。
IOException
如果I/O错误发生。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.