2、ds FilterInputStream { 7. 8. public CppInputStream(InputStream in) { 9. super(in); 10. } 11. public final int read(byte b[]) throws IOException { 12. return in.read(b, 0, b.length); 13. } 14. 15. public final int read(byte b[], int
3、 off, int len) throws IOException { 16. return in.read(b, off, len); 17. } 18. 19. public final void readFully(byte b[]) throws IOException { 20. readFully(b, 0, b.length); 21. } 22. 23. public final void readFully(byte b[], int off,
4、 int len) throws IOException { 24. if (len < 0) 25. throw new IndexOutOfBoundsException(); 26. int n = 0; 27. while (n < len) { 28. int count = in.read(b, off + n, len - n); 29. if (count < 0) 30. throw new EOFExc
5、eption(); 31. n += count; 32. } 33. } 34. 35. public final int skipBytes(int n) throws IOException { 36. int total = 0; 37. int cur = 0; 38. while ((total < n) && ((cur = (int) in.skip(n - total)) > 0)) { 1. total += c
6、ur; 2. } 3. return total; 4. } 5. 6. public final byte readByte() throws IOException { 7. int ch = in.read(); 8. if (ch < 0) 9. throw new EOFException(); 10. return (byte) (ch); 11. } 12. 13. public final int readUn
7、signedByte() throws IOException { 14. int ch = in.read(); 15. if (ch < 0) 16. throw new EOFException(); 17. return ch; 18. } 19. 20. public final short readShort() throws IOException { 21. int ch2 = in.read(); 22. int ch
8、1 = in.read(); 23. if ((ch1
9、 ch2) < 0) 24. throw new EOFException(); 25. return (short) ((ch1 << 8) + (ch2 << 0)); 26. } 27. 28. public final int readUnsignedShort() throws IOException { 29. int ch2 = in.read(); 30.