Returns the next record in the master file. This will process any directives before the next record. @return The next record. @throws IOException The master file could not be read, or was syntactically invalid.
()
| 270 | * invalid. |
| 271 | */ |
| 272 | public Record |
| 273 | _nextRecord() throws IOException { |
| 274 | Tokenizer.Token token; |
| 275 | String s; |
| 276 | |
| 277 | if (included != null) { |
| 278 | Record rec = included.nextRecord(); |
| 279 | if (rec != null) |
| 280 | return rec; |
| 281 | included = null; |
| 282 | } |
| 283 | if (generator != null) { |
| 284 | Record rec = nextGenerated(); |
| 285 | if (rec != null) |
| 286 | return rec; |
| 287 | endGenerate(); |
| 288 | } |
| 289 | while (true) { |
| 290 | Name name; |
| 291 | |
| 292 | token = st.get(true, false); |
| 293 | if (token.type == Tokenizer.WHITESPACE) { |
| 294 | Tokenizer.Token next = st.get(); |
| 295 | if (next.type == Tokenizer.EOL) |
| 296 | continue; |
| 297 | else if (next.type == Tokenizer.EOF) |
| 298 | return null; |
| 299 | else |
| 300 | st.unget(); |
| 301 | if (last == null) |
| 302 | throw st.exception("no owner"); |
| 303 | name = last.getName(); |
| 304 | } |
| 305 | else if (token.type == Tokenizer.EOL) |
| 306 | continue; |
| 307 | else if (token.type == Tokenizer.EOF) |
| 308 | return null; |
| 309 | else if (((String) token.value).charAt(0) == '$') { |
| 310 | s = token.value; |
| 311 | |
| 312 | if (s.equalsIgnoreCase("$ORIGIN")) { |
| 313 | origin = st.getName(Name.root); |
| 314 | st.getEOL(); |
| 315 | continue; |
| 316 | } else if (s.equalsIgnoreCase("$TTL")) { |
| 317 | defaultTTL = st.getTTL(); |
| 318 | st.getEOL(); |
| 319 | continue; |
| 320 | } else if (s.equalsIgnoreCase("$INCLUDE")) { |
| 321 | String filename = st.getString(); |
| 322 | File newfile; |
| 323 | if (file != null) { |
| 324 | String parent = file.getParent(); |
| 325 | newfile = new File(parent, filename); |
| 326 | } else { |
| 327 | newfile = new File(filename); |
| 328 | } |
| 329 | Name incorigin = origin; |
no test coverage detected