源碼如下:
public synchronized void write(int b) throws IOException {
if (count >= buf.length) {
flushBuffer();
}
buf[count++] = (byte)b;
}
為何寫字節(jié)要用int類型? int是四個(gè)字節(jié),byte是一個(gè)字節(jié),為何(byte)b?
Java: BufferedOutputStream里的write(int b)如何理解?
喵喵時(shí)光機(jī)
2019-02-16 17:33:20