Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/act365/net/dns/ResourceRecord.java


1   /*
2     * JSocket Wrench
3     * 
4     * Copyright (C) act365.com October 2003
5     * 
6     * Web site: http://www.act365.com/wrench
7     * E-mail: developers@act365.com
8     * 
9     * The JSocket Wrench library adds support for low-level Internet protocols
10    * to the Java programming language.
11    * 
12    * This program is free software; you can redistribute it and/or modify it 
13    * under the terms of the GNU General Public License as published by the Free 
14    * Software Foundation; either version 2 of the License, or (at your option) 
15    * any later version.
16    *  
17    * This program is distributed in the hope that it will be useful, 
18    * but WITHOUT ANY WARRANTY; without even the implied warranty of 
19    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
20    * Public License for more details.
21    * 
22    * You should have received a copy of the GNU General Public License along with 
23    * this program; if not, write to the Free Software Foundation, Inc., 
24    * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25    */
26  
27  package com.act365.net.dns ;
28  
29  public class ResourceRecord {
30  
31    byte[] domain_name ;
32    short type ;
33    short resource_class ;
34    int time_to_live ;
35    byte[] data ;
36    String data_string ;
37  
38    /**
39     Trivial constructor
40    */
41  
42    public ResourceRecord( byte[] domain_name ,
43                           short type ,
44                           short resource_class ,
45                           int time_to_live ,
46                           byte[] data ,
47                           String data_string ) {
48      this.domain_name = domain_name ;
49      this.type = type ;
50      this.resource_class = resource_class ;
51      this.time_to_live = time_to_live ;
52      this.data = data ;
53      this.data_string = data_string ;
54    }
55  
56    /**
57     Length of byte array
58    */
59  
60    public int length() {
61      return 10 + domain_name.length + data.length ;
62    }
63  
64    /**
65     String representation
66    */
67  
68    public String toString() {
69      return data_string ;
70    }
71  }
72