source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/api/org/apache/hadoop/net/NetUtils.html @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 48.5 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0_07) on Tue Sep 01 20:56:54 UTC 2009 -->
6<TITLE>
7NetUtils (Hadoop 0.20.1 API)
8</TITLE>
9
10<META NAME="date" CONTENT="2009-09-01">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="NetUtils (Hadoop 0.20.1 API)";
19    }
20}
21</SCRIPT>
22<NOSCRIPT>
23</NOSCRIPT>
24
25</HEAD>
26
27<BODY BGCOLOR="white" onload="windowTitle();">
28<HR>
29
30
31<!-- ========= START OF TOP NAVBAR ======= -->
32<A NAME="navbar_top"><!-- --></A>
33<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35<TR>
36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37<A NAME="navbar_top_firstrow"><!-- --></A>
38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39  <TR ALIGN="center" VALIGN="top">
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<SCRIPT type="text/javascript">
64  <!--
65  if(window==top) {
66    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67  }
68  //-->
69</SCRIPT>
70<NOSCRIPT>
71  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
72</NOSCRIPT>
73
74
75</FONT></TD>
76</TR>
77<TR>
78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
82</TR>
83</TABLE>
84<A NAME="skip-navbar_top"></A>
85<!-- ========= END OF TOP NAVBAR ========= -->
86
87<HR>
88<!-- ======== START OF CLASS DATA ======== -->
89<H2>
90<FONT SIZE="-1">
91org.apache.hadoop.net</FONT>
92<BR>
93Class NetUtils</H2>
94<PRE>
95<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
96  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.net.NetUtils</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public class <B>NetUtils</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
101</PRE>
102
103<P>
104<HR>
105
106<P>
107
108<!-- ======== CONSTRUCTOR SUMMARY ======== -->
109
110<A NAME="constructor_summary"><!-- --></A>
111<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
112<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
113<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
114<B>Constructor Summary</B></FONT></TH>
115</TR>
116<TR BGCOLOR="white" CLASS="TableRowColor">
117<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()">NetUtils</A></B>()</CODE>
118
119<BR>
120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
121</TR>
122</TABLE>
123&nbsp;
124<!-- ========== METHOD SUMMARY =========== -->
125
126<A NAME="method_summary"><!-- --></A>
127<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
128<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
129<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
130<B>Method Summary</B></FONT></TH>
131</TR>
132<TR BGCOLOR="white" CLASS="TableRowColor">
133<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
134<CODE>static&nbsp;void</CODE></FONT></TD>
135<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)">addStaticResolution</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host,
136                    <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resolvedName)</CODE>
137
138<BR>
139&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a static resolution for host.</TD>
140</TR>
141<TR BGCOLOR="white" CLASS="TableRowColor">
142<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
143<CODE>static&nbsp;void</CODE></FONT></TD>
144<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#connect(java.net.Socket, java.net.SocketAddress, int)">connect</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
145        <A HREF="http://java.sun.com/javase/6/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A>&nbsp;endpoint,
146        int&nbsp;timeout)</CODE>
147
148<BR>
149&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is a drop-in replacement for
150 <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(SocketAddress, int)</CODE></A>.</TD>
151</TR>
152<TR BGCOLOR="white" CLASS="TableRowColor">
153<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
154<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
155<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String)">createSocketAddr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target)</CODE>
156
157<BR>
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Util method to build socket addr from either:
159   <host>:<post>
160   <fs>://<host>:<port>/<path></TD>
161</TR>
162<TR BGCOLOR="white" CLASS="TableRowColor">
163<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
164<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
165<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String, int)">createSocketAddr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target,
166                 int&nbsp;defaultPort)</CODE>
167
168<BR>
169&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Util method to build socket addr from either:
170   <host>
171   <host>:<post>
172   <fs>://<host>:<port>/<path></TD>
173</TR>
174<TR BGCOLOR="white" CLASS="TableRowColor">
175<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
176<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&gt;</CODE></FONT></TD>
177<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getAllStaticResolutions()">getAllStaticResolutions</A></B>()</CODE>
178
179<BR>
180&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is used to get all the resolutions that were added using
181 <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>.</TD>
182</TR>
183<TR BGCOLOR="white" CLASS="TableRowColor">
184<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
185<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
186<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getConnectAddress(org.apache.hadoop.ipc.Server)">getConnectAddress</A></B>(<A HREF="../../../../org/apache/hadoop/ipc/Server.html" title="class in org.apache.hadoop.ipc">Server</A>&nbsp;server)</CODE>
187
188<BR>
189&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns InetSocketAddress that a client can use to
190 connect to the server.</TD>
191</TR>
192<TR BGCOLOR="white" CLASS="TableRowColor">
193<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
194<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
195<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getDefaultSocketFactory(org.apache.hadoop.conf.Configuration)">getDefaultSocketFactory</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf)</CODE>
196
197<BR>
198&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the default socket factory as specified by the configuration
199 parameter <tt>hadoop.rpc.socket.factory.default</tt></TD>
200</TR>
201<TR BGCOLOR="white" CLASS="TableRowColor">
202<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
203<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A></CODE></FONT></TD>
204<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket)">getInputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)</CODE>
205
206<BR>
207&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
208 
209 From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
210 Returns InputStream for the socket.</TD>
211</TR>
212<TR BGCOLOR="white" CLASS="TableRowColor">
213<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
214<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A></CODE></FONT></TD>
215<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)">getInputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
216               long&nbsp;timeout)</CODE>
217
218<BR>
219&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns InputStream for the socket.</TD>
220</TR>
221<TR BGCOLOR="white" CLASS="TableRowColor">
222<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
223<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
224<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket)">getOutputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)</CODE>
225
226<BR>
227&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as getOutputStream(socket, 0).</TD>
228</TR>
229<TR BGCOLOR="white" CLASS="TableRowColor">
230<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
231<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
232<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)">getOutputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
233                long&nbsp;timeout)</CODE>
234
235<BR>
236&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns OutputStream for the socket.</TD>
237</TR>
238<TR BGCOLOR="white" CLASS="TableRowColor">
239<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
240<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
241<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getServerAddress(org.apache.hadoop.conf.Configuration, java.lang.String, java.lang.String, java.lang.String)">getServerAddress</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
242                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldBindAddressName,
243                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldPortName,
244                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newBindAddressName)</CODE>
245
246<BR>
247&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;</TD>
248</TR>
249<TR BGCOLOR="white" CLASS="TableRowColor">
250<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
251<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
252<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getSocketFactory(org.apache.hadoop.conf.Configuration, java.lang.Class)">getSocketFactory</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
253                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;clazz)</CODE>
254
255<BR>
256&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the socket factory for the given class according to its
257 configuration parameter
258 <tt>hadoop.rpc.socket.factory.class.&lt;ClassName&gt;</tt>.</TD>
259</TR>
260<TR BGCOLOR="white" CLASS="TableRowColor">
261<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
262<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
263<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getSocketFactoryFromProperty(org.apache.hadoop.conf.Configuration, java.lang.String)">getSocketFactoryFromProperty</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
264                             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;propValue)</CODE>
265
266<BR>
267&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the socket factory corresponding to the given proxy URI.</TD>
268</TR>
269<TR BGCOLOR="white" CLASS="TableRowColor">
270<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
271<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
272<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)">getStaticResolution</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host)</CODE>
273
274<BR>
275&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the resolved name for the passed host.</TD>
276</TR>
277<TR BGCOLOR="white" CLASS="TableRowColor">
278<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
279<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
280<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostName(java.lang.String)">normalizeHostName</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</CODE>
281
282<BR>
283&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given a string representation of a host, return its ip address
284 in textual presentation.</TD>
285</TR>
286<TR BGCOLOR="white" CLASS="TableRowColor">
287<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
288<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;</CODE></FONT></TD>
289<TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostNames(java.util.Collection)">normalizeHostNames</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;&nbsp;names)</CODE>
290
291<BR>
292&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given a collection of string representation of hosts, return a list of
293 corresponding IP addresses in the textual representation.</TD>
294</TR>
295</TABLE>
296&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
297<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
298<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
299<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
300</TR>
301<TR BGCOLOR="white" CLASS="TableRowColor">
302<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
303</TR>
304</TABLE>
305&nbsp;
306<P>
307
308<!-- ========= CONSTRUCTOR DETAIL ======== -->
309
310<A NAME="constructor_detail"><!-- --></A>
311<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
312<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
313<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
314<B>Constructor Detail</B></FONT></TH>
315</TR>
316</TABLE>
317
318<A NAME="NetUtils()"><!-- --></A><H3>
319NetUtils</H3>
320<PRE>
321public <B>NetUtils</B>()</PRE>
322<DL>
323</DL>
324
325<!-- ============ METHOD DETAIL ========== -->
326
327<A NAME="method_detail"><!-- --></A>
328<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
329<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
330<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
331<B>Method Detail</B></FONT></TH>
332</TR>
333</TABLE>
334
335<A NAME="getSocketFactory(org.apache.hadoop.conf.Configuration, java.lang.Class)"><!-- --></A><H3>
336getSocketFactory</H3>
337<PRE>
338public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
339                                             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;clazz)</PRE>
340<DL>
341<DD>Get the socket factory for the given class according to its
342 configuration parameter
343 <tt>hadoop.rpc.socket.factory.class.&lt;ClassName&gt;</tt>. When no
344 such parameter exists then fall back on the default socket factory as
345 configured by <tt>hadoop.rpc.socket.factory.class.default</tt>. If
346 this default socket factory is not configured, then fall back on the JVM
347 default socket factory.
348<P>
349<DD><DL>
350<DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration<DD><CODE>clazz</CODE> - the class (usually a <A HREF="../../../../org/apache/hadoop/ipc/VersionedProtocol.html" title="interface in org.apache.hadoop.ipc"><CODE>VersionedProtocol</CODE></A>)
351<DT><B>Returns:</B><DD>a socket factory</DL>
352</DD>
353</DL>
354<HR>
355
356<A NAME="getDefaultSocketFactory(org.apache.hadoop.conf.Configuration)"><!-- --></A><H3>
357getDefaultSocketFactory</H3>
358<PRE>
359public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getDefaultSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf)</PRE>
360<DL>
361<DD>Get the default socket factory as specified by the configuration
362 parameter <tt>hadoop.rpc.socket.factory.default</tt>
363<P>
364<DD><DL>
365<DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration
366<DT><B>Returns:</B><DD>the default socket factory as specified in the configuration or
367         the JVM default socket factory if the configuration does not
368         contain a default socket factory property.</DL>
369</DD>
370</DL>
371<HR>
372
373<A NAME="getSocketFactoryFromProperty(org.apache.hadoop.conf.Configuration, java.lang.String)"><!-- --></A><H3>
374getSocketFactoryFromProperty</H3>
375<PRE>
376public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getSocketFactoryFromProperty</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
377                                                         <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;propValue)</PRE>
378<DL>
379<DD>Get the socket factory corresponding to the given proxy URI. If the
380 given proxy URI corresponds to an absence of configuration parameter,
381 returns null. If the URI is malformed raises an exception.
382<P>
383<DD><DL>
384<DT><B>Parameters:</B><DD><CODE>propValue</CODE> - the property which is the class name of the
385        SocketFactory to instantiate; assumed non null and non empty.
386<DT><B>Returns:</B><DD>a socket factory as defined in the property value.</DL>
387</DD>
388</DL>
389<HR>
390
391<A NAME="createSocketAddr(java.lang.String)"><!-- --></A><H3>
392createSocketAddr</H3>
393<PRE>
394public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>createSocketAddr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target)</PRE>
395<DL>
396<DD>Util method to build socket addr from either:
397   <host>:<post>
398   <fs>://<host>:<port>/<path>
399<P>
400<DD><DL>
401</DL>
402</DD>
403</DL>
404<HR>
405
406<A NAME="createSocketAddr(java.lang.String, int)"><!-- --></A><H3>
407createSocketAddr</H3>
408<PRE>
409public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>createSocketAddr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target,
410                                                 int&nbsp;defaultPort)</PRE>
411<DL>
412<DD>Util method to build socket addr from either:
413   <host>
414   <host>:<post>
415   <fs>://<host>:<port>/<path>
416<P>
417<DD><DL>
418</DL>
419</DD>
420</DL>
421<HR>
422
423<A NAME="getServerAddress(org.apache.hadoop.conf.Configuration, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
424getServerAddress</H3>
425<PRE>
426<FONT SIZE="-1"><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</A>
427</FONT>public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getServerAddress</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
428                                                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldBindAddressName,
429                                                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldPortName,
430                                                 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newBindAddressName)</PRE>
431<DL>
432<DD><B>Deprecated.</B>&nbsp;
433<P>
434<DD>Handle the transition from pairs of attributes specifying a host and port
435 to a single colon separated one.
436<P>
437<DD><DL>
438<DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration to check<DD><CODE>oldBindAddressName</CODE> - the old address attribute name<DD><CODE>oldPortName</CODE> - the old port attribute name<DD><CODE>newBindAddressName</CODE> - the new combined name
439<DT><B>Returns:</B><DD>the complete address from the configuration</DL>
440</DD>
441</DL>
442<HR>
443
444<A NAME="addStaticResolution(java.lang.String, java.lang.String)"><!-- --></A><H3>
445addStaticResolution</H3>
446<PRE>
447public static void <B>addStaticResolution</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host,
448                                       <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resolvedName)</PRE>
449<DL>
450<DD>Adds a static resolution for host. This can be used for setting up
451 hostnames with names that are fake to point to a well known host. For e.g.
452 in some testcases we require to have daemons with different hostnames
453 running on the same machine. In order to create connections to these
454 daemons, one can set up mappings from those hostnames to "localhost".
455 <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)"><CODE>getStaticResolution(String)</CODE></A> can be used to query for
456 the actual hostname.
457<P>
458<DD><DL>
459<DT><B>Parameters:</B><DD><CODE>host</CODE> - <DD><CODE>resolvedName</CODE> - </DL>
460</DD>
461</DL>
462<HR>
463
464<A NAME="getStaticResolution(java.lang.String)"><!-- --></A><H3>
465getStaticResolution</H3>
466<PRE>
467public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getStaticResolution</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host)</PRE>
468<DL>
469<DD>Retrieves the resolved name for the passed host. The resolved name must
470 have been set earlier using
471 <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>
472<P>
473<DD><DL>
474<DT><B>Parameters:</B><DD><CODE>host</CODE> -
475<DT><B>Returns:</B><DD>the resolution</DL>
476</DD>
477</DL>
478<HR>
479
480<A NAME="getAllStaticResolutions()"><!-- --></A><H3>
481getAllStaticResolutions</H3>
482<PRE>
483public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&gt; <B>getAllStaticResolutions</B>()</PRE>
484<DL>
485<DD>This is used to get all the resolutions that were added using
486 <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>. The return
487 value is a List each element of which contains an array of String
488 of the form String[0]=hostname, String[1]=resolved-hostname
489<P>
490<DD><DL>
491
492<DT><B>Returns:</B><DD>the list of resolutions</DL>
493</DD>
494</DL>
495<HR>
496
497<A NAME="getConnectAddress(org.apache.hadoop.ipc.Server)"><!-- --></A><H3>
498getConnectAddress</H3>
499<PRE>
500public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>getConnectAddress</B>(<A HREF="../../../../org/apache/hadoop/ipc/Server.html" title="class in org.apache.hadoop.ipc">Server</A>&nbsp;server)</PRE>
501<DL>
502<DD>Returns InetSocketAddress that a client can use to
503 connect to the server. Server.getListenerAddress() is not correct when
504 the server binds to "0.0.0.0". This returns "127.0.0.1:port" when
505 the getListenerAddress() returns "0.0.0.0:port".
506<P>
507<DD><DL>
508<DT><B>Parameters:</B><DD><CODE>server</CODE> -
509<DT><B>Returns:</B><DD>socket address that a client can use to connect to the server.</DL>
510</DD>
511</DL>
512<HR>
513
514<A NAME="getInputStream(java.net.Socket)"><!-- --></A><H3>
515getInputStream</H3>
516<PRE>
517public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> <B>getInputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)
518                                  throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
519<DL>
520<DD>Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
521 
522 From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
523 Returns InputStream for the socket. If the socket has an associated
524 SocketChannel then it returns a
525 <A HREF="../../../../org/apache/hadoop/net/SocketInputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketInputStream</CODE></A> with the given timeout. If the socket does not
526 have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A> is returned. In the later
527 case, the timeout argument is ignored and the timeout set with
528 <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#setSoTimeout(int)" title="class or interface in java.net"><CODE>Socket.setSoTimeout(int)</CODE></A> applies for reads.<br><br>
529
530 Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
531 must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A>.
532<P>
533<DD><DL>
534<DT><B>Parameters:</B><DD><CODE>socket</CODE> -
535<DT><B>Returns:</B><DD>InputStream for reading from the socket.
536<DT><B>Throws:</B>
537<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A></DL>
538</DD>
539</DL>
540<HR>
541
542<A NAME="getInputStream(java.net.Socket, long)"><!-- --></A><H3>
543getInputStream</H3>
544<PRE>
545public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> <B>getInputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
546                                         long&nbsp;timeout)
547                                  throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
548<DL>
549<DD>Returns InputStream for the socket. If the socket has an associated
550 SocketChannel then it returns a
551 <A HREF="../../../../org/apache/hadoop/net/SocketInputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketInputStream</CODE></A> with the given timeout. If the socket does not
552 have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A> is returned. In the later
553 case, the timeout argument is ignored and the timeout set with
554 <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#setSoTimeout(int)" title="class or interface in java.net"><CODE>Socket.setSoTimeout(int)</CODE></A> applies for reads.<br><br>
555 
556 Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
557 must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A>.
558<P>
559<DD><DL>
560<DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
561        for waiting as long as necessary.
562<DT><B>Returns:</B><DD>InputStream for reading from the socket.
563<DT><B>Throws:</B>
564<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getChannel()" title="class or interface in java.net"><CODE>Socket.getChannel()</CODE></A></DL>
565</DD>
566</DL>
567<HR>
568
569<A NAME="getOutputStream(java.net.Socket)"><!-- --></A><H3>
570getOutputStream</H3>
571<PRE>
572public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> <B>getOutputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)
573                                    throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
574<DL>
575<DD>Same as getOutputStream(socket, 0). Timeout of zero implies write will
576 wait until data is available.<br><br>
577 
578 From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)"><CODE>getOutputStream(Socket, long)</CODE></A> : <br>
579 Returns OutputStream for the socket. If the socket has an associated
580 SocketChannel then it returns a
581 <A HREF="../../../../org/apache/hadoop/net/SocketOutputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketOutputStream</CODE></A> with the given timeout. If the socket does not
582 have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A> is returned. In the later
583 case, the timeout argument is ignored and the write will wait until
584 data is available.<br><br>
585 
586 Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
587 must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A>.
588<P>
589<DD><DL>
590<DT><B>Parameters:</B><DD><CODE>socket</CODE> -
591<DT><B>Returns:</B><DD>OutputStream for writing to the socket.
592<DT><B>Throws:</B>
593<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)"><CODE>getOutputStream(Socket, long)</CODE></A></DL>
594</DD>
595</DL>
596<HR>
597
598<A NAME="getOutputStream(java.net.Socket, long)"><!-- --></A><H3>
599getOutputStream</H3>
600<PRE>
601public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> <B>getOutputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
602                                           long&nbsp;timeout)
603                                    throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
604<DL>
605<DD>Returns OutputStream for the socket. If the socket has an associated
606 SocketChannel then it returns a
607 <A HREF="../../../../org/apache/hadoop/net/SocketOutputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketOutputStream</CODE></A> with the given timeout. If the socket does not
608 have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A> is returned. In the later
609 case, the timeout argument is ignored and the write will wait until
610 data is available.<br><br>
611 
612 Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
613 must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A>.
614<P>
615<DD><DL>
616<DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
617        for waiting as long as necessary.
618<DT><B>Returns:</B><DD>OutputStream for writing to the socket.
619<DT><B>Throws:</B>
620<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getChannel()" title="class or interface in java.net"><CODE>Socket.getChannel()</CODE></A></DL>
621</DD>
622</DL>
623<HR>
624
625<A NAME="connect(java.net.Socket, java.net.SocketAddress, int)"><!-- --></A><H3>
626connect</H3>
627<PRE>
628public static void <B>connect</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
629                           <A HREF="http://java.sun.com/javase/6/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A>&nbsp;endpoint,
630                           int&nbsp;timeout)
631                    throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
632<DL>
633<DD>This is a drop-in replacement for
634 <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(SocketAddress, int)</CODE></A>.
635 In the case of normal sockets that don't have associated channels, this
636 just invokes <code>socket.connect(endpoint, timeout)</code>. If
637 <code>socket.getChannel()</code> returns a non-null channel,
638 connect is implemented using Hadoop's selectors. This is done mainly
639 to avoid Sun's connect implementation from creating thread-local
640 selectors, since Hadoop does not have control on when these are closed
641 and could end up taking all the available file descriptors.
642<P>
643<DD><DL>
644<DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>endpoint</CODE> - <DD><CODE>timeout</CODE> - - timeout in milliseconds
645<DT><B>Throws:</B>
646<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(java.net.SocketAddress, int)</CODE></A></DL>
647</DD>
648</DL>
649<HR>
650
651<A NAME="normalizeHostName(java.lang.String)"><!-- --></A><H3>
652normalizeHostName</H3>
653<PRE>
654public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>normalizeHostName</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</PRE>
655<DL>
656<DD>Given a string representation of a host, return its ip address
657 in textual presentation.
658<P>
659<DD><DL>
660<DT><B>Parameters:</B><DD><CODE>name</CODE> - a string representation of a host:
661             either a textual representation its IP address or its host name
662<DT><B>Returns:</B><DD>its IP address in the string format</DL>
663</DD>
664</DL>
665<HR>
666
667<A NAME="normalizeHostNames(java.util.Collection)"><!-- --></A><H3>
668normalizeHostNames</H3>
669<PRE>
670public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt; <B>normalizeHostNames</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;&nbsp;names)</PRE>
671<DL>
672<DD>Given a collection of string representation of hosts, return a list of
673 corresponding IP addresses in the textual representation.
674<P>
675<DD><DL>
676<DT><B>Parameters:</B><DD><CODE>names</CODE> - a collection of string representations of hosts
677<DT><B>Returns:</B><DD>a list of corresponding IP addresses in the string format<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostName(java.lang.String)"><CODE>normalizeHostName(String)</CODE></A></DL>
678</DD>
679</DL>
680<!-- ========= END OF CLASS DATA ========= -->
681<HR>
682
683
684<!-- ======= START OF BOTTOM NAVBAR ====== -->
685<A NAME="navbar_bottom"><!-- --></A>
686<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
687<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
688<TR>
689<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
690<A NAME="navbar_bottom_firstrow"><!-- --></A>
691<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
692  <TR ALIGN="center" VALIGN="top">
693  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
694  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
695  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
696  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
697  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
698  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
699  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
700  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
701  </TR>
702</TABLE>
703</TD>
704<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
705</EM>
706</TD>
707</TR>
708
709<TR>
710<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
711&nbsp;<A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>&nbsp;
712&nbsp;<A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
713<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
714  <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
715&nbsp;<A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
716&nbsp;<SCRIPT type="text/javascript">
717  <!--
718  if(window==top) {
719    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
720  }
721  //-->
722</SCRIPT>
723<NOSCRIPT>
724  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
725</NOSCRIPT>
726
727
728</FONT></TD>
729</TR>
730<TR>
731<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
732  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
733<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
734DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
735</TR>
736</TABLE>
737<A NAME="skip-navbar_bottom"></A>
738<!-- ======== END OF BOTTOM NAVBAR ======= -->
739
740<HR>
741Copyright &copy; 2009 The Apache Software Foundation
742</BODY>
743</HTML>
Note: See TracBrowser for help on using the repository browser.