127 METHOD |
127 METHOD |
128 Bytestream::ensure_read_space (unsigned int bytes) -> void |
128 Bytestream::ensure_read_space (unsigned int bytes) -> void |
129 { |
129 { |
130 if (bytes_left() < bytes) |
130 if (bytes_left() < bytes) |
131 { |
131 { |
132 throw IOError (format ("attempted to read %1 byte(s) past the end of bytestream", |
132 int bytesPast = bytes - bytes_left(); |
133 bytes - bytes_left())); |
133 |
|
134 String message; |
|
135 message.sprintf ("attempted to read %d byte%s past the end of bytestream", |
|
136 bytesPast, bytesPast != -1 ? "s" : ""); |
|
137 throw IOError (message); |
134 } |
138 } |
135 } |
139 } |
136 |
140 |
137 // ------------------------------------------------------------------------------------------------- |
141 // ------------------------------------------------------------------------------------------------- |
138 // |
142 // |