/** * Add an authoritative answer to the message. * * @param rec * @exception IOException */ public void addAuthorativeAnswer(DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _authoritativeAnswers.add(rec); _authoritativeAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an additional answer to the record. Omit if there is no room. * * @param in * @param rec * @exception IOException */ public void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _additionals.add(rec); _additionalsAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an authoritative answer to the message. * * @param rec * @exception IOException */ public void addAuthorativeAnswer(DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _authoritativeAnswers.add(rec); _authoritativeAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
message.writeRecord(record, now); message.writeRecord(record, now); message.writeRecord(record, now);
/** * Builds the final message buffer to be send and returns it. * * @return bytes to send. */ public byte[] data() { long now = System.currentTimeMillis(); // System.currentTimeMillis() _names.clear(); MessageOutputStream message = new MessageOutputStream(_maxUDPPayload, this); message.writeShort(_multicast ? 0 : this.getId()); message.writeShort(this.getFlags()); message.writeShort(this.getNumberOfQuestions()); message.writeShort(this.getNumberOfAnswers()); message.writeShort(this.getNumberOfAuthorities()); message.writeShort(this.getNumberOfAdditionals()); for (DNSQuestion question : _questions) { message.writeQuestion(question); } for (DNSRecord record : _answers) { message.writeRecord(record, now); } for (DNSRecord record : _authoritativeAnswers) { message.writeRecord(record, now); } for (DNSRecord record : _additionals) { message.writeRecord(record, now); } return message.toByteArray(); }
/** * Builds the final message buffer to be send and returns it. * * @return bytes to send. */ public byte[] data() { long now = System.currentTimeMillis(); // System.currentTimeMillis() _names.clear(); MessageOutputStream message = new MessageOutputStream(_maxUDPPayload, this); message.writeShort(_multicast ? 0 : this.getId()); message.writeShort(this.getFlags()); message.writeShort(this.getNumberOfQuestions()); message.writeShort(this.getNumberOfAnswers()); message.writeShort(this.getNumberOfAuthorities()); message.writeShort(this.getNumberOfAdditionals()); for (DNSQuestion question : _questions) { message.writeQuestion(question); } for (DNSRecord record : _answers) { message.writeRecord(record, now); } for (DNSRecord record : _authoritativeAnswers) { message.writeRecord(record, now); } for (DNSRecord record : _additionals) { message.writeRecord(record, now); } return message.toByteArray(); }
/** * Builds the final message buffer to be send and returns it. * * @return bytes to send. */ public byte[] data() { long now = System.currentTimeMillis(); // System.currentTimeMillis() _names.clear(); MessageOutputStream message = new MessageOutputStream(_maxUDPPayload, this); message.writeShort(_multicast ? 0 : this.getId()); message.writeShort(this.getFlags()); message.writeShort(this.getNumberOfQuestions()); message.writeShort(this.getNumberOfAnswers()); message.writeShort(this.getNumberOfAuthorities()); message.writeShort(this.getNumberOfAdditionals()); for (DNSQuestion question : _questions) { message.writeQuestion(question); } for (DNSRecord record : _answers) { message.writeRecord(record, now); } for (DNSRecord record : _authoritativeAnswers) { message.writeRecord(record, now); } for (DNSRecord record : _additionals) { message.writeRecord(record, now); } return message.toByteArray(); }
/** * Add an answer to the message. * * @param rec * @param now * @exception IOException */ public void addAnswer(DNSRecord rec, long now) throws IOException { if (rec != null) { if ((now == 0) || !rec.isExpired(now)) { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, now); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _answers.add(rec); _answersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } } } }
/** * Add an answer to the message. * * @param rec * @param now * @exception IOException */ public void addAnswer(DNSRecord rec, long now) throws IOException { if (rec != null) { if ((now == 0) || !rec.isExpired(now)) { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, now); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _answers.add(rec); _answersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } } } }
/** * Add an answer to the message. * * @param rec * @param now * @exception IOException */ public void addAnswer(DNSRecord rec, long now) throws IOException { if (rec != null) { if ((now == 0) || !rec.isExpired(now)) { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, now); byte[] byteArray = record.toByteArray(); record.close(); if (byteArray.length < this.availableSpace()) { _answers.add(rec); _answersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } } } }
/** * Add an answer to the message. * * @param rec * @param now * @exception IOException */ public void addAnswer(DNSRecord rec, long now) throws IOException { if (rec != null) { if ((now == 0) || !rec.isExpired(now)) { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, now); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _answers.add(rec); _answersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } } } }
/** * Add an additional answer to the record. Omit if there is no room. * * @param in * @param rec * @exception IOException */ public void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _additionals.add(rec); _additionalsAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an authoritative answer to the message. * * @param rec * @exception IOException */ public void addAuthorativeAnswer(DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); record.close(); if (byteArray.length < this.availableSpace()) { _authoritativeAnswers.add(rec); _authoritativeAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an additional answer to the record. Omit if there is no room. * * @param in * @param rec * @exception IOException */ public void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _additionals.add(rec); _additionalsAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an authoritative answer to the message. * * @param rec * @exception IOException */ public void addAuthorativeAnswer(DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); if (byteArray.length < this.availableSpace()) { _authoritativeAnswers.add(rec); _authoritativeAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }
/** * Add an additional answer to the record. Omit if there is no room. * * @param in * @param rec * @exception IOException */ public void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException { MessageOutputStream record = new MessageOutputStream(512, this); record.writeRecord(rec, 0); byte[] byteArray = record.toByteArray(); record.close(); if (byteArray.length < this.availableSpace()) { _additionals.add(rec); _additionalsAnswersBytes.write(byteArray, 0, byteArray.length); } else { throw new IOException("message full"); } }