Changeset 11428
- Timestamp:
- 12/06/08 19:33:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/open-external-format/src/org/armedbear/lisp/Stream.java
r11425 r11428 64 64 protected boolean isBinaryStream; 65 65 66 private boolean pastEnd = false; 66 67 private boolean interactive; 67 68 private boolean open = true; … … 204 205 { 205 206 if (! (reader instanceof PushbackReader)) 206 this.reader = new PushbackReader(reader, 2);207 this.reader = new PushbackReader(reader, 5); 207 208 else 208 209 this.reader = (PushbackReader)reader; … … 1737 1738 public LispObject listen() throws ConditionThrowable 1738 1739 { 1739 return _charReady() ? T : NIL; 1740 if (pastEnd) 1741 return NIL; 1742 1743 if (! _charReady()) 1744 return NIL; 1745 1746 int n = _readChar(); 1747 if (n < 0) 1748 return NIL; 1749 1750 _unreadChar(n); 1751 1752 return T; 1740 1753 } 1741 1754 … … 1785 1798 protected int _readChar() throws ConditionThrowable 1786 1799 { 1800 if (pastEnd) 1801 return -1; 1802 1787 1803 try 1788 1804 { 1789 1805 int n = reader.read(); 1790 1806 1791 if (n < 0) 1807 if (n < 0) { 1808 pastEnd = true; 1792 1809 return -1; 1810 } 1793 1811 1794 1812 ++offset; … … 2012 2030 try 2013 2031 { 2014 return in.read(); // Reads an 8-bit byte. 2032 int n = in.read(); 2033 if (n < 0) 2034 pastEnd = true; 2035 2036 return n; // Reads an 8-bit byte. 2015 2037 } 2016 2038 catch (IOException e) … … 2081 2103 try 2082 2104 { 2105 int n = 0; 2083 2106 while (in.available() > 0) 2084 in.read(); 2107 n = in.read(); 2108 2109 if (n < 0) 2110 pastEnd = true; 2085 2111 } 2086 2112 catch (IOException e)
Note: See TracChangeset
for help on using the changeset viewer.