คำถามติดแท็ก bufferedinputstream

4
เหตุใด BufferedInputStream จึงคัดลอกฟิลด์ไปยังตัวแปรโลคัลแทนที่จะใช้ฟิลด์โดยตรง
เมื่อฉันอ่านซอร์สโค้ดจากjava.io.BufferedInputStream.getInIfOpen()ฉันก็งงว่าทำไมมันถึงเขียนโค้ดแบบนี้: /** * Check to make sure that underlying input stream has not been * nulled out due to close; if not return it; */ private InputStream getInIfOpen() throws IOException { InputStream input = in; if (input == null) throw new IOException("Stream closed"); return input; } เหตุใดจึงใช้นามแฝงแทนการใช้ตัวแปรฟิลด์inโดยตรงเช่นด้านล่าง: /** * Check …
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.