Source Code Cross Referenced for NAPTRRecord.java in  » Net » dnsjava » org » xbill » DNS » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » dnsjava » org.xbill.DNS 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (c) 2000-2004 Brian Wellington (bwelling@xbill.org)
002:
003:        package org.xbill.DNS;
004:
005:        import java.io.*;
006:
007:        /**
008:         * Name Authority Pointer Record  - specifies rewrite rule, that when applied
009:         * to an existing string will produce a new domain.
010:         *
011:         * @author Chuck Santos
012:         */
013:
014:        public class NAPTRRecord extends Record {
015:
016:            private int order, preference;
017:            private byte[] flags, service, regexp;
018:            private Name replacement;
019:
020:            NAPTRRecord() {
021:            }
022:
023:            Record getObject() {
024:                return new NAPTRRecord();
025:            }
026:
027:            /**
028:             * Creates an NAPTR Record from the given data
029:             * @param order The order of this NAPTR.  Records with lower order are
030:             * preferred.
031:             * @param preference The preference, used to select between records at the
032:             * same order.
033:             * @param flags The control aspects of the NAPTRRecord.
034:             * @param service The service or protocol available down the rewrite path.
035:             * @param regexp The regular/substitution expression.
036:             * @param replacement The domain-name to query for the next DNS resource
037:             * record, depending on the value of the flags field.
038:             * @throws IllegalArgumentException One of the strings has invalid escapes
039:             */
040:            public NAPTRRecord(Name name, int dclass, long ttl, int order,
041:                    int preference, String flags, String service,
042:                    String regexp, Name replacement) {
043:                super (name, Type.NAPTR, dclass, ttl);
044:                this .order = checkU16("order", order);
045:                this .preference = checkU16("preference", preference);
046:                try {
047:                    this .flags = byteArrayFromString(flags);
048:                    this .service = byteArrayFromString(service);
049:                    this .regexp = byteArrayFromString(regexp);
050:                } catch (TextParseException e) {
051:                    throw new IllegalArgumentException(e.getMessage());
052:                }
053:                this .replacement = checkName("replacement", replacement);
054:            }
055:
056:            void rrFromWire(DNSInput in) throws IOException {
057:                order = in.readU16();
058:                preference = in.readU16();
059:                flags = in.readCountedString();
060:                service = in.readCountedString();
061:                regexp = in.readCountedString();
062:                replacement = new Name(in);
063:            }
064:
065:            void rdataFromString(Tokenizer st, Name origin) throws IOException {
066:                order = st.getUInt16();
067:                preference = st.getUInt16();
068:                try {
069:                    flags = byteArrayFromString(st.getString());
070:                    service = byteArrayFromString(st.getString());
071:                    regexp = byteArrayFromString(st.getString());
072:                } catch (TextParseException e) {
073:                    throw st.exception(e.getMessage());
074:                }
075:                replacement = st.getName(origin);
076:            }
077:
078:            /** Converts rdata to a String */
079:            String rrToString() {
080:                StringBuffer sb = new StringBuffer();
081:                sb.append(order);
082:                sb.append(" ");
083:                sb.append(preference);
084:                sb.append(" ");
085:                sb.append(byteArrayToString(flags, true));
086:                sb.append(" ");
087:                sb.append(byteArrayToString(service, true));
088:                sb.append(" ");
089:                sb.append(byteArrayToString(regexp, true));
090:                sb.append(" ");
091:                sb.append(replacement);
092:                return sb.toString();
093:            }
094:
095:            /** Returns the order */
096:            public int getOrder() {
097:                return order;
098:            }
099:
100:            /** Returns the preference */
101:            public int getPreference() {
102:                return preference;
103:            }
104:
105:            /** Returns flags */
106:            public String getFlags() {
107:                return byteArrayToString(flags, false);
108:            }
109:
110:            /** Returns service */
111:            public String getService() {
112:                return byteArrayToString(service, false);
113:            }
114:
115:            /** Returns regexp */
116:            public String getRegexp() {
117:                return byteArrayToString(regexp, false);
118:            }
119:
120:            /** Returns the replacement domain-name */
121:            public Name getReplacement() {
122:                return replacement;
123:            }
124:
125:            void rrToWire(DNSOutput out, Compression c, boolean canonical) {
126:                out.writeU16(order);
127:                out.writeU16(preference);
128:                out.writeCountedString(flags);
129:                out.writeCountedString(service);
130:                out.writeCountedString(regexp);
131:                replacement.toWire(out, null, canonical);
132:            }
133:
134:            public Name getAdditionalName() {
135:                return replacement;
136:            }
137:
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.