锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲人色大成年网站在线观看,亚洲成Av人片乱码色午夜,亚洲国产精品嫩草影院 http://m.tkk7.com/lazing/category/12906.htmlFuture network: Share and Create...zh-cnFri, 18 May 2007 02:24:17 GMTFri, 18 May 2007 02:24:17 GMT60Java Notes: Data types and Operatorshttp://m.tkk7.com/lazing/archive/2007/05/17/118189.htmlHIMMELHIMMELThu, 17 May 2007 14:48:00 GMThttp://m.tkk7.com/lazing/archive/2007/05/17/118189.htmlhttp://m.tkk7.com/lazing/comments/118189.htmlhttp://m.tkk7.com/lazing/archive/2007/05/17/118189.html#Feedback0http://m.tkk7.com/lazing/comments/commentRss/118189.htmlhttp://m.tkk7.com/lazing/services/trackbacks/118189.htmlComprehend
  • A variable holds a value, while an object reference variable points to the memory that holds the object.
  • The short-circuit logical operators && and || operate only on boolean operands. For example, the expression
    9&&7 will not compile. Understand the difference between short-circuit logical operators and bitwise
    operators.
  • If the first expression of a && operator is false, the second expression is not evaluated, and if the first
    expression of a || operator is true, the second expression is not evaluated.

Look Out

  • Be on guard for words that are only slightly different from the Java keywords, such as synchronize instead of synchronized, implement instead of implements, and protect instead of protected.
  • Whether an array stores primitive variables or object references, the array itself is always an object.
  • It is illegal to include the array size in the array declaration.
  • Division by zero generates a runtime ArithmeticException only if the operands are integers. In case of float and double, the result of division by zero is infinity.
  • The result of the modulo operator always carries the sign of the first operand (i.e. the one before the operator);
    you can ignore the sign of the second operand.
  • You cannot instantiate an enum by using the new operator.

Memorize

  • Know the Java language keywords.
  • Know the range of values for all primitive data types.
  • All primitive data types except boolean and char are signed.
  • The first character of an identifier must be a letter, a dollar sign ($), or an underscore (_). Characters other than the first character in an identifier may be a letter, a dollar sign, an underscore, or a digit.


HIMMEL 2007-05-17 22:48 鍙戣〃璇勮
]]>
Java Notes: Classes, Methods, and Interfacehttp://m.tkk7.com/lazing/archive/2007/05/17/118188.htmlHIMMELHIMMELThu, 17 May 2007 14:47:00 GMThttp://m.tkk7.com/lazing/archive/2007/05/17/118188.htmlhttp://m.tkk7.com/lazing/comments/118188.htmlhttp://m.tkk7.com/lazing/archive/2007/05/17/118188.html#Feedback0http://m.tkk7.com/lazing/comments/commentRss/118188.htmlhttp://m.tkk7.com/lazing/services/trackbacks/118188.htmlComprehend
  • The method name and return type are mandatory in a method declaration. Even though you are not required to specify a modifier in a method declaration, the default modifier is assigned to the method, if you don’t declare one.
  • A static variable belongs to the class and not to a particular instance of the class, and therefore is initialized when the class is loaded, and before the class is instantiated.
  • Because a static method belongs to a class and not to a particular instance of the class, it cannot access the nonstatic methods and variables of the class in which it is defined.
  • An instance of an inner class can only exist in an instance of the outer class, and has direct access to all the instance variables and methods of the outer instance.
  • If you make a super call or a this call, it must be in the beginning of a constructor. That means you can make either a super call or a this call, but not both.

Look Out

  • The variable-length parameters list must appear last in the parentheses of a method and it consists of a data type, three dots, and a name, in that order.
  • A Java class cannot inherit from more than one class, but it can inherit from one class and one or more interfaces.
  • The class that inherits from an interface must provide implementation for all the methods that are declared in the interface if the class is not abstract.
  • An interface can extend another interface but it cannot implement another interface or a class.

Memorize

  • If you do not provide any constructor for a class you write, the compiler provides the default constructor for that class. If you write at least one constructor for the class, the compiler provides no constructor.
  • If you don not make a this or a super call in the beginning of a constructor, the compiler places a super() call there.
  • You use the keyword extends to write a derived class that inherits from a parent class, and use the keyword implements to write a class that inherits from an interface.
  • The methods in an interface are inherently public and abstract, and the variables in the interface are inherently public, final, and static.


HIMMEL 2007-05-17 22:47 鍙戣〃璇勮
]]>
JavaMail API 瀹炰緥姹囨?/title><link>http://m.tkk7.com/lazing/archive/2007/05/17/118184.html</link><dc:creator>HIMMEL</dc:creator><author>HIMMEL</author><pubDate>Thu, 17 May 2007 14:30:00 GMT</pubDate><guid>http://m.tkk7.com/lazing/archive/2007/05/17/118184.html</guid><wfw:comment>http://m.tkk7.com/lazing/comments/118184.html</wfw:comment><comments>http://m.tkk7.com/lazing/archive/2007/05/17/118184.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/lazing/comments/commentRss/118184.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/lazing/services/trackbacks/118184.html</trackback:ping><description><![CDATA[<div id="hrtvlxp" class="postentry"> <p>鍛冿紝濂藉惂錛屾垜鍙啓榪囦笁涓狫avaMail鐨勭▼搴忋?/p> <p>閮芥槸鎵歸噺閭歡瀹堟姢紼嬪簭銆傚喅瀹氭葷粨涓涓嬶紝甯屾湜闈炲父騫歌繍鎵懼埌榪欑瘒鏂囩珷鐨勪漢涓嶄細鍐嶅榪欎釜鍥版儜銆?/p> <h3>蹇呴』鏄庣櫧鐨勫熀紜鐭ヨ瘑</h3> <ol> <li>STMP鍗忚鏄浣曞伐浣滅殑<br> 鍗忚鐨勬爣鍑嗗湪榪欓噷 <a >http://www.ietf.org/rfc/rfc2821.txt?number=2821</a><br> 涓嬮潰鏄壖瑕佽鏄庯紙<a >http://www.freesoft.org/CIE/Topics/94.htm</a> 錛夛細 <blockquote> <p>Simple Mail Transfer Protocol (SMTP), documented in RFC 821, is Internet’s standard host-to-host mail transport protocol and traditionally operates over TCP, port 25. In other words, a UNIX user can type telnet hostname 25 and connect with an SMTP server, if one is present.</p> <p>SMTP uses a style of asymmetric request-response protocol popular in the early 1980s, and still seen occasionally, most often in mail protocols. The protocol is designed to be equally useful to either a computer or a human, though not too forgiving of the human. From the server’s viewpoint, a clear set of commands is provided and well-documented in the RFC. For the human, all the commands are clearly terminated by newlines and a HELP command lists all of them. From the sender’s viewpoint, the command replies always take the form of text lines, each starting with a three-digit code identifying the result of the operation, a continuation character to indicate another lines following, and then arbitrary text information designed to be informative to a human.</p> </blockquote> <p>浜嬪疄涓婏紝浣犲彲浠ュ儚浣跨敤DOS鍛戒護涓鏍峰彂閫佺數(shù)瀛愰偖浠躲?a >http://bbs.stcore.com/archiver/tid-8024.htm </a>褰撶劧鍥犱負鍚勭鍘熷洜錛屼綘鐨勫皾璇曚笉鍙兘鎴愬姛銆備簨瀹炰笂SMTP宸ヤ綔鐨勬椂鍊欏氨鏄畝鍗曠殑鍙戦佸懡浠ゃ傚彇寰楄璇侊紝鍙戦佹暟鎹傚緱鍒板弽棣堛傜‘璁ら鍑鴻繖涔堢畝鍗曘? </p> </li> <li>SMTP涓敤浜庡彂閫佺殑鏁版嵁<br> SMTP涓彂閫佺殑鏁版嵁錛岄伒浠?font size="-1"><strong>Multipurpose Internet Mail</strong> <strong>Extensions</strong> (<strong>MIME</strong>)鏍囧噯錛屽憙錛屾垜涓嶅緱涓嶈錛岃繖鏄繖涓槦鐞冧笂鏈閲嶈鐨勬爣鍑嗕箣涓銆傛墍鏈夌殑浜掕仈緗戦氫俊鍩烘湰閮芥槸鍩轟簬榪欎釜鏍囧噯鐨勬紨鍖栥傞櫎浜嗙數(shù)瀛愰偖浠訛紝甯歌鐨勫簲鐢ㄨ繕鍖呮嫭HTTP鎶ユ枃絳夛紙涔熷氨鏄墍鏈夌綉欏典簡錛夛紝鍙﹀鍗充嬌鍦?0騫村悗鍙戝睍鐨刋ML錛屽叾2榪涘埗鏁版嵁鍙戦佷粛鐒跺疄鐢ㄧ殑MIME涓殑緙栫爜鏂瑰紡銆?br> 鎭╋紝榪欓噷灝辨秹鍙婂埌閭歡闄勪歡濡備綍澶勭悊鐨勯棶棰樸傛仼錛岀畝鍗曞湴璇村氨鏄疊ASE64緙栫爜</font></li> </ol> <blockquote> <pre>Table 1: The Base64 Alphabet<br><br>Value Encoding Value Encoding Value Encoding Value Encoding</pre> <pre>0 A 17 R 34 i 51 z<br><br>1 B 18 S 35 j 52 0<br><br>2 C 19 T 36 k 53 1<br><br>3 D 20 U 37 l 54 2<br><br>4 E 21 V 38 m 55 3<br><br>5 F 22 W 39 n 56 4<br><br>6 G 23 X 40 o 57 5<br><br>7 H 24 Y 41 p 58 6<br><br>8 I 25 Z 42 q 59 7<br><br>9 J 26 a 43 r 60 8<br><br>10 K 27 b 44 s 61 9<br><br>11 L 28 c 45 t 62 +<br><br>12 M 29 d 46 u 63 /<br><br>13 N 30 e 47 v<br><br>14 O 31 f 48 w (pad) =<br><br>15 P 32 g 49 x<br><br>16 Q 33 h 50 y</pre> </blockquote> <p>鍦ㄨ繖縐嶇紪鐮佷腑錛屾垜浠皢瀛楃鎴栬呬簩榪涘埗緙栫爜浠?涓瘮鐗逛綅涓轟竴緇勶紝鏇挎崲鎴愮浉搴旂殑瀛楃褰㈠紡銆傛瘮濡?/p> <pre>100110111010001011101001</pre> <p>杞崲緇撴灉灝辨槸</p> <pre>100110 -> 38</pre> <pre>111010 -> 58<br><br>001011 -> 11<br><br>101001 -> 41</pre> <pre>38 -> m<br><br>58 -> 6<br><br>11 -> L<br><br>41 -> p</pre> <pre>m6Lp</pre> <p>浜庢槸錛屾垜浠氨鍙互浠ユ枃鏈殑鏂瑰紡緙栫爜浜岃繘鍒舵祦浠ュ強鎵╁睍ASCII瀛楃錛屾瘮濡備腑鏂囧瓧絎︺?/p> <p>鍩虹鐭ヨ瘑瀹屾瘯錛屼笅闈㈡槸FAQ</p> <h3>Java鍙戦佺數(shù)瀛愰偖浠墮渶瑕佸摢浜涜蔣浠跺寘</h3> <p>mail.jar 閫氬父榪樹細闇瑕?activation.jar</p> <blockquote> <p>涓嬭澆鍦板潃<br> http://java.sun.com/products/javabeans/jaf/downloads/index.html<br> https://maven-repository.dev.java.net/nonav/repository/javax.mail/</p> </blockquote> <h3>濡備綍鍙戦侀偖浠?/h3> <p>鍏充簬錛?/p> <ul> <li>濡備綍鍙戦侀偖浠?/li> <li>濡備綍鍙戦佸甫鏈夐檮浠剁殑閭歡</li> <li>濡備綍鍙戦佷腑鏂囬偖浠?/li> <li>閭歡涓枃鏍囬涔辯爜鎬庝箞鍔?/li> <li>閭歡闄勪歡涔辯爜鎬庝箞鍔炵瓑絳夐棶棰?/li> </ul> <p>璇鋒煡鐪嬩互涓嬩唬鐮?/p> <pre class="java"> <span style="color: blue; font-weight: bold;">public</span> <span style="color: blue; font-weight: bold;">static</span> <span style="color: blue; font-weight: bold;">synchronized</span> <span style="color: #993333;">void</span> sendMail<span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">Properties</span></a> settings<span style="color: #66cc66;">)</span><br> <br> <span style="color: blue; font-weight: bold;">throws</span> <a ><span style="color: red; font-weight: bold;">Exception</span></a> <span style="color: #66cc66;">{</span><br> <br> <a ><span style="color: red; font-weight: bold;">Properties</span></a> props = <span style="color: blue; font-weight: bold;">new</span> <a ><span style="color: red; font-weight: bold;">Properties</span></a><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br> props.<span style="color: #006600;">put</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"mail.smtp.host"</span>, settings.<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span>StartCore.<span style="color: #006600;">MAIL_SERVER</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br> props.<span style="color: #006600;">put</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"mail.smtp.user"</span>, settings.<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span>StartCore.<span style="color: #006600;">USER_NAME</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br> props.<span style="color: #006600;">put</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"mail.smtp.auth"</span>, <span style="color: #ff0000;">"true"</span><span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">//SMTP鏈嶅姟鍣ㄧ敤鎴烽獙璇?/span><br> <br> <a ><span style="color: red; font-weight: bold;">Authenticator</span></a> auth = <span style="color: blue; font-weight: bold;">new</span> SMTPAuthenticator<span style="color: #66cc66;">(</span><span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">String</span></a><span style="color: #66cc66;">)</span> settings<br> <br> .<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span>StartCore.<span style="color: #006600;">USER_NAME</span><span style="color: #66cc66;">)</span>, <span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">String</span></a><span style="color: #66cc66;">)</span> settings<br> <br> .<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span>StartCore.<span style="color: #006600;">PASSWORD</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br> Session session = Session.<span style="color: #006600;">getDefaultInstance</span><span style="color: #66cc66;">(</span>props, auth<span style="color: #66cc66;">)</span>;<br> <br><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">(</span><span style="color: #ff0000;">"true"</span>.<span style="color: #006600;">compareToIgnoreCase</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">String</span></a><span style="color: #66cc66;">)</span> settings.<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"DEBUG"</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> <br> session.<span style="color: #006600;">setDebug</span><span style="color: #66cc66;">(</span><span style="color: blue; font-weight: bold;">true</span><span style="color: #66cc66;">)</span>;<br> <br> <span style="color: #66cc66;">}</span><br> <br><span style="color: #808080; font-style: italic;">//鍒涘緩娑堟伅浣?/span><br> <br> MimeMessage msg = <span style="color: blue; font-weight: bold;">new</span> MimeMessage<span style="color: #66cc66;">(</span>session<span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">//璁劇疆鍙戦佷漢閭歡</span><br> <br> msg.<span style="color: #006600;">setFrom</span><span style="color: #66cc66;">(</span><span style="color: blue; font-weight: bold;">new</span> InternetAddress<span style="color: #66cc66;">(</span><span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">String</span></a><span style="color: #66cc66;">)</span> settings<br> <br> .<span style="color: #006600;">get</span><span style="color: #66cc66;">(</span>StartCore.<span style="color: #006600;">USER_MAIL</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">//璁劇疆鎺ユ敹浜洪偖浠?/span><br> <br> address = <span style="color: blue; font-weight: bold;">new</span> InternetAddress<span style="color: #66cc66;">[</span><span style="color: #66cc66;">]</span> <span style="color: #66cc66;">{</span> <span style="color: blue; font-weight: bold;">new</span> InternetAddress<span style="color: #66cc66;">(</span>rs<br> <br> .<span style="color: #006600;">getString</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"GRE_mail"</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">}</span>;<br> <br> msg.<span style="color: #006600;">setRecipients</span><span style="color: #66cc66;">(</span>Message.<span style="color: #006600;">RecipientType</span>.<span style="color: #006600;">TO</span>, address<span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">//璁劇疆涓婚錛屼腑鏂囩紪鐮?/span><br> <br> msg.<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">(</span>subject, <span style="color: #ff0000;">"gbk"</span><span style="color: #66cc66;">)</span>;<br> <br> msg.<span style="color: #006600;">setSentDate</span><span style="color: #66cc66;">(</span><span style="color: blue; font-weight: bold;">new</span> <a ><span style="color: red; font-weight: bold;">Date</span></a><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br><a ><span style="color: red; font-weight: bold;">String</span></a> content = <span style="color: #ff0000;">"閭歡姝f枃"</span>;<br> <br> MimeBodyPart mbp1 = <span style="color: blue; font-weight: bold;">new</span> MimeBodyPart<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br> mbp1.<span style="color: #006600;">setText</span><span style="color: #66cc66;">(</span>content, <span style="color: #ff0000;">"gbk"</span><span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">//閭歡闄勪歡</span><br> <br>MimeBodyPart attachFilePart = <span style="color: blue; font-weight: bold;">new</span> MimeBodyPart<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br><a ><span style="color: red; font-weight: bold;">File</span></a> file = <span style="color: blue; font-weight: bold;">new</span> <a ><span style="color: red; font-weight: bold;">File</span></a><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"涓枃闄勪歡.txt"</span><span style="color: #66cc66;">)</span>;<br> <br>FileDataSource fds = <span style="color: blue; font-weight: bold;">new</span> FileDataSource<span style="color: #66cc66;">(</span>file.<span style="color: #006600;">getName</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br>attachFilePart.<span style="color: #006600;">setDataHandler</span><span style="color: #66cc66;">(</span><span style="color: blue; font-weight: bold;">new</span> DataHandler<span style="color: #66cc66;">(</span>fds<span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span>;<br> <br> sun.<span style="color: #006600;">misc</span>.<span style="color: #006600;">BASE64Encoder</span> enc = <span style="color: blue; font-weight: bold;">new</span> sun.<span style="color: #006600;">misc</span>.<span style="color: #006600;">BASE64Encoder</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br> <span style="color: #808080; font-style: italic;">//瑙e喅涓枃闄勪歡鍚嶇О</span><br> <br> attachFilePart.<span style="color: #006600;">setFileName</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"=?gbk?B?"</span><br> <br> + enc.<span style="color: #006600;">encode</span><span style="color: #66cc66;">(</span>file.<span style="color: #006600;">getName</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>.<span style="color: #006600;">getBytes</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"gbk"</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span> + <span style="color: #ff0000;">"?="</span><span style="color: #66cc66;">)</span>;<br> <br>Multipart mp = <span style="color: blue; font-weight: bold;">new</span> MimeMultipart<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br> mp.<span style="color: #006600;">addBodyPart</span><span style="color: #66cc66;">(</span>mbp1<span style="color: #66cc66;">)</span>;<br> <br> mp.<span style="color: #006600;">addBodyPart</span><span style="color: #66cc66;">(</span>attachFilePart<span style="color: #66cc66;">)</span>;<br> <br>msg.<span style="color: #006600;">setContent</span><span style="color: #66cc66;">(</span>mp<span style="color: #66cc66;">)</span>;<br> <br><span style="color: #808080; font-style: italic;">// send the message</span><br> <br> msg.<span style="color: #006600;">saveChanges</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;<br> <br> Transport.<span style="color: #006600;">send</span><span style="color: #66cc66;">(</span>msg<span style="color: #66cc66;">)</span>;<br> <br><span style="color: #66cc66;">}</span></pre> <p>榪欐槸涓婇潰鐢ㄦ埛楠岃瘉鐢ㄥ埌鐨勭被</p> <pre class="java"><span style="color: blue; font-weight: bold;">class</span> SMTPAuthenticator <span style="color: blue; font-weight: bold;">extends</span> javax.<span style="color: #006600;">mail</span>.<a ><span style="color: red; font-weight: bold;">Authenticator</span></a> <span style="color: #66cc66;">{</span></pre> <pre class="java"> <span style="color: blue; font-weight: bold;">private</span> <a ><span style="color: red; font-weight: bold;">String</span></a> username;<br> <br> <span style="color: blue; font-weight: bold;">private</span> <a ><span style="color: red; font-weight: bold;">String</span></a> password;<br> <br> <span style="color: #808080; font-style: italic;">/**<br> <br> * @param username<br> <br> * @param password<br> <br> */</span><br> <br> <span style="color: blue; font-weight: bold;">public</span> SMTPAuthenticator<span style="color: #66cc66;">(</span><a ><span style="color: red; font-weight: bold;">String</span></a> username, <a ><span style="color: red; font-weight: bold;">String</span></a> password<span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> <br> <span style="color: blue; font-weight: bold;">this</span>.<span style="color: #006600;">username</span> = username;<br> <br> <span style="color: blue; font-weight: bold;">this</span>.<span style="color: #006600;">password</span> = password;<br> <br> <span style="color: #66cc66;">}</span><br> <br> <span style="color: blue; font-weight: bold;">public</span> <a ><span style="color: red; font-weight: bold;">PasswordAuthentication</span></a> getPasswordAuthentication<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> <br> <span style="color: blue; font-weight: bold;">return</span> <span style="color: blue; font-weight: bold;">new</span> <a ><span style="color: red; font-weight: bold;">PasswordAuthentication</span></a><span style="color: #66cc66;">(</span>username, password<span style="color: #66cc66;">)</span>;<br> <br> <span style="color: #66cc66;">}</span><br> <br><span style="color: #66cc66;">}</span></pre> <h3>閭歡鍙戦佸嚭閿?/h3> <blockquote> <p>What causes an “javax.activation.UnsupportedDataTypeException: no object DCH for MIME type xxx/xxxx javax.mail.MessagingException: IOException while sending message;” to be sent and how do I fix this? [This happens for known MIME types like text/htm</p> </blockquote> <p>浜嬪疄涓婅繖涓槸閭歡鍙戦佹椂楠岃瘉緇勪歡璁劇疆涓嶅綋寮曡搗鐨勶紝榪欎釜緇勪歡閰嶇疆鏂規(guī)硶濡備笅</p> <blockquote> <p>(http://java.sun.com/j2ee/1.4/docs/api/javax/activation/MailcapCommandMap.html)</p> <p>The MailcapCommandMap looks in various places in the user’s system for mailcap file entries. When requests are made to search for commands in the MailcapCommandMap, it searches mailcap files in the following order:</p> <p>1) Programatically added entries to the MailcapCommandMap instance.<br> 2) The file .mailcap in the user’s home directory.<br> 3) The file /lib/mailcap.<br> 4) The file or resources named META-INF/mailcap.<br> 5) The file or resource named META-INF/mailcap.default (usually found only in the activation.jar file).</p> </blockquote> <p>鎴戦夌敤浜嗙鍥涚鏂規(guī)硶錛屽湪鐢熸垚鐨凧ar鏂囦歡涓姞鍏ヤ簡 META-INF/mailcap.</p> <pre class="apache"><span style="color: #adadad; font-style: italic;">#</span><br><span style="color: #adadad; font-style: italic;"># This is a very simple 'mailcap' file</span><br><span style="color: #adadad; font-style: italic;">#</span><br>image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer<br>image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer<br>text/*;; x-java-view=com.sun.activation.viewers.TextViewer<br>text/*;; x-java-edit=com.sun.activation.viewers.TextEditor<br>text/html;; x-java-content-handler=com.sun.mail.handlers.text_html<br>text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml<br>text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain<br>multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed<br>message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822</pre> </div><img src ="http://m.tkk7.com/lazing/aggbug/118184.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/lazing/" target="_blank">HIMMEL</a> 2007-05-17 22:30 <a href="http://m.tkk7.com/lazing/archive/2007/05/17/118184.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Java IO note 1http://m.tkk7.com/lazing/archive/2007/01/03/91592.htmlHIMMELHIMMELWed, 03 Jan 2007 09:25:00 GMThttp://m.tkk7.com/lazing/archive/2007/01/03/91592.htmlhttp://m.tkk7.com/lazing/comments/91592.htmlhttp://m.tkk7.com/lazing/archive/2007/01/03/91592.html#Feedback0http://m.tkk7.com/lazing/comments/commentRss/91592.htmlhttp://m.tkk7.com/lazing/services/trackbacks/91592.html Return value of read()

For instance, according to the Java class library documentation, the read( ) method of java.io.InputStream returns "the next byte of data, or -1 if the end of the stream is reached." Upon reflection, this sounds suspicious. How is a -1 that appears as part of the stream data to be distinguished from a -1 indicating end of stream? In point of fact, the read( ) method does not return a byte; its signature shows that it returns an int:

1 public abstract int 聽read(聽)聽 throws 聽IOException

This int is not a Java byte with a value between -128 and 127 but a more general unsigned byte with a value between 0 and 255. Hence, -1 can easily be distinguished from valid data values read from the stream.


JVM and byte, byte array

In fact, a single byte still takes up four bytes of space inside the Java virtual machine, but a byte array occupies only the amount of space it actually needs. The virtual machine includes special instructions for operating on byte arrays but does not include any instructions for operating on single bytes. They're just promoted to ints.


Input, Output, Reader and Writer

For the most part, these classes have methods that are extremely similar to the equivalent stream classes. Often the only difference is that a byte in the signature of a stream method becomes a char in the signature of the matching reader or writer method. For example, the java.io.OutputStream class declares these three write( ) methods:

				

The java.io.Writer class, therefore, declares these three write( ) methods:

				

As you can see, the signatures match except that in the latter two methods the byte array data has changed to a char array. There's also a less obvious difference not reflected in the signature. While the int passed to the OutputStream write( ) method is reduced modulo 256 before being output, the int passed to the Writer write( ) method is reduced modulo 65,536. This reflects the different ranges of chars and bytes.

java.io.Writer also has two more write( ) methods that take their data from a string:

				public void write(String s) 
throws IOException
public void write(String s, int offset, int length) throws IOException

Because streams don't know how to deal with character-based data, there are no corresponding methods in the java.io.OutputStream class.


Hello World!

1聽聽 byte []聽hello聽 = { 72 ,聽 101 ,聽 108 ,聽 108 ,聽 111 ,聽 32 ,聽 87 ,聽 111 ,聽 114 ,聽 108 ,聽 100 ,聽 33 ,聽 10 , 13 } ;
2 System.out.write(hello);

Del.icio.us : ,

Powered by Zoundry



HIMMEL 2007-01-03 17:25 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 伊人久久免费视频| 国产免费午夜a无码v视频| 亚洲成a人片在线观| 夜夜嘿视频免费看| 国产伦精品一区二区免费| 日韩精品亚洲人成在线观看 | 99视频在线观看免费| 亚洲色偷偷av男人的天堂| 免费网站看v片在线香蕉| aa在线免费观看| 国产v亚洲v天堂a无| 日韩一卡2卡3卡4卡新区亚洲| 88av免费观看| 鲁啊鲁在线视频免费播放| 久久久亚洲AV波多野结衣| 免费在线看片网站| 99久9在线|免费| 人成午夜免费大片在线观看| 亚洲欧洲尹人香蕉综合| 丝袜熟女国偷自产中文字幕亚洲| 麻豆一区二区免费播放网站| 成在线人免费无码高潮喷水| 亚洲综合一区国产精品| 亚洲高清国产AV拍精品青青草原| 四虎永久精品免费观看| 国产精品入口麻豆免费观看| 国产人成网在线播放VA免费| 亚洲日韩亚洲另类激情文学| 亚洲欧洲免费视频| 国产aⅴ无码专区亚洲av麻豆 | 草久免费在线观看网站| 亚洲人成影院在线高清| 亚洲人成网亚洲欧洲无码久久| 精品免费国产一区二区三区 | 最近2019中文字幕免费直播| 日韩毛片一区视频免费| 亚洲中文字幕久在线| 亚洲AV无码成人专区片在线观看| 亚洲?v女人的天堂在线观看| 毛色毛片免费观看| 精品国产污污免费网站aⅴ|