<html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <base href="http://wiki.javaforum.hu" />
        <style type="text/css">
    body, #email-content, #email-content-inner { font-family: Arial,FreeSans,Helvetica,sans-serif; }
    body, p, blockquote, pre, code, td, th, li, dt, dd { font-size: 13px; }
    small { font-size: 11px; }

    body { width:100% !important; -webkit-font-smoothing: antialiased; }

    body,
    #email-wrapper { background-color: #f0f0f0; }
    #email-wrapper-inner { padding: 20px; text-align: center; }
    #email-content-inner { background-color: #fff; border: 1px solid #bbb; color: $menuTxtColour; padding:20px; text-align:left; }
    #email-wrapper-inner > table { width: 100%; }
    #email-wrapper-inner.thin > table { margin: 0 auto; width: 50%; }
    #email-footer { padding: 0 16px 32px 16px; margin: 0; }

    .email-indent { margin: 8px 0 16px 0; }
    .email-comment { margin: 0 0 0 56px; }

    #email-title-avatar { text-align: left; vertical-align: top; width: 56px; }
    #email-title-flavor { margin: 0; padding: 0 0 4px 0; }
    #email-title-heading { font-size: 16px; line-height: 20px; min-height: 20px; margin: 0; padding: 0; }
    #email-title .icon { border: 0; padding: 0 2px 0 0; text-align: left; }

    #email-actions { border-top: 1px solid #bbb; color: #505050; margin: 8px 0 0 0; padding: 0; }
    #email-actions td { padding-top: 8px; }
    #email-actions .left { max-width: 45%; text-align: left; }
    #email-actions .right { text-align: right; }
    .email-reply-divider { border-top: 1px solid #bbb; color: #505050; margin: 32px 0 8px 0; padding: 8px 0; }
    .email-section-title { border-bottom: 1px solid #bbb; margin: 8px 0; padding: 8px 0 0 0; }

    .email-metadata { color: #505050; }

    a { color: #326ca6; text-decoration: none; }
    a:hover { color: #336ca6; text-decoration: underline; }
    a:active {color: #326ca6; }

    a.email-footer-link { color: #505050; font-size: 11px; }

    .email-item-list { list-style: none; margin: 4px 0; padding-left: 0; }
    .email-item-list li { list-style: none; margin: 0; padding: 4px 0; }
    .email-list-divider { color: #505050; padding: 0 0.35em; }

    .avatar { -ms-interpolation-mode: bicubic; }
    .avatar-link { margin: 2px; }

    .tableview th { border-bottom: 1px solid #69C; font-weight: bold; text-align: left; }
    .tableview td { border-bottom: 1px solid #bbbbbb; text-align: left; padding: 4px 16px 4px 0; }

    .aui-message {  margin: 1em 0; padding: 8px; }
    .aui-message.info { background-color: #e0f0ff; border: 1px solid #9eb6d4; }
    .aui-message.success { background-color: #ddfade; border: 1px solid #93c49f; }
    .aui-message.error,
    .aui-message.removed { background-color: #ffe7e7; border: 1px solid #df9898; color: #000; }

    .call-to-action-table { margin: 10px 1px 1px 1px;}
    .call-to-action-container { text-align: right; padding: 5px 20px; border: 1px solid #326396;  background-color: #6495C7; border-radius: 3px;}
    .call-to-action-container a.call-to-action-button { background-color: #6495C7; font-size: 15pt; line-height: 1; padding: 0; margin: 0; color: #fff; }

            @media handheld, only screen and (max-device-width: 480px) {
        div, a, p, td, th, li, dt, dd { -webkit-text-size-adjust: auto; }
        small, small a { -webkit-text-size-adjust: 90%; }

        td[id=email-wrapper-inner] { padding: 2px !important; }
        td[id=email-content-inner] { padding: 8px !important; }
        td[id="email-wrapper-inner"][class="thin"] > table { text-align: left !important; width: 100% !important; }
        td[id=email-footer] { padding: 8px 12px !important; }
        div[class=email-indent] { margin: 8px 0px !important; }
        div[class=email-comment] { margin: 0 !important; }

        p[id=email-title-flavor] a { display: block; } /* puts the username and the action on separate lines */
        p[id=email-permalink] { padding: 4px 0 0 0 !important; }

        table[id=email-actions] td { padding-top: 0 !important; }
        table[id=email-actions] td.right { text-align: right !important; }
        table[id=email-actions] .email-list-item { display: block; margin: 1em 0 !important; word-wrap: normal !important; }
        span[class=email-list-divider] { display: none; }
    }

        </style>
    </head>
    <body bgcolor="#f0f0f0" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" style="font-family: Arial, FreeSans, Helvetica, sans-serif; font-size: 13px; width: 100%; -webkit-font-smoothing: antialiased; background-color: #f0f0f0">
        <table id="email-wrapper" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #f0f0f0">
            <tbody>
                <tr valign="middle">
                    <td id="email-wrapper-inner" style="font-size: 13px; padding: 20px; text-align: center">
                        <table id="email-content" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial, FreeSans, Helvetica, sans-serif; width: 100%">
                            <tbody>
                                <tr valign="top">
                                    <td id="email-content-inner" align="left" style="font-family: Arial, FreeSans, Helvetica, sans-serif; font-size: 13px; background-color: #fff; border: 1px solid #bbb; padding: 20px; text-align: left">
                                        <table id="email-title" cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tbody>
                                                <tr>
                                                    <td id="email-title-avatar" rowspan="2" style="font-size: 13px; text-align: left; vertical-align: top; width: 56px"> <img class="avatar" src="cid:avatar_d7177d5506ab05ef431ea35647b597a3" border="0" height="48" width="48" style="-ms-interpolation-mode: bicubic" /> </td>
                                                    <td valign="top" style="font-size: 13px">
                                                        <div id="email-title-flavor" class="email-metadata" style="margin: 0; padding: 0 0 4px 0; color: #505050">
                                                            <a href="http://wiki.javaforum.hu/display/~auth.gabor" style="color:#326ca6;text-decoration:none;; color: #326ca6; text-decoration: none">Auth G&aacute;bor</a> wrote a blog post:
                                                        </div> </td>
                                                </tr>
                                                <tr>
                                                    <td valign="top" style="font-size: 13px"> <h2 id="email-title-heading" style="font-size: 16px; line-height: 20px; min-height: 20px; margin: 0; padding: 0"> <a href="http://wiki.javaforum.hu/display/JAVAFORUM/2012/08/12/NIO.2" style="color: #326ca6; text-decoration: none"> <img class="icon" src="cid:blogpost-icon" alt="" style="border: 0; padding: 0 2px 0 0; text-align: left" /> <strong style="font-size:16px;line-height:20px;vertical-align:top;">NIO.2</strong> </a> </h2> </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <div class="email-indent" style="margin: 8px 0 16px 0">
                                            <div class="email-page">
                                                <p style="font-size: 13px">A Java7 megjelen&eacute;s&eacute;t megelőzően nagy v&aacute;rakoz&aacute;s &ouml;vezte a NIO.2 &uacute;jdons&aacute;gait, azt&aacute;n elm&uacute;lt a <em>hype</em>. Ennek oka val&oacute;sz&iacute;nűleg az lehet, hogy a Java jelenleg k&eacute;t erős ter&uuml;let&eacute;n – az Android &eacute;s a Java EE platformon – nincs igaz&aacute;n sz&uuml;ks&eacute;g a f&aacute;jlműveletek t&aacute;mogat&aacute;s&aacute;ra. Az Android eset&eacute;n megtűrt dolognak sz&aacute;m&iacute;t a f&aacute;jlrendszer, az SQLite alap&uacute; t&aacute;rter&uuml;let a t&aacute;mogatott; Java EE eset&eacute;n pedig deklar&aacute;ltan nem alapozunk a f&aacute;jlrendszerre.</p>
                                                <p style="font-size: 13px">Nem mindenki lehet Android vagy Java EE fejlesztő – sz&uuml;ks&eacute;ges az IDE-k fejleszt&eacute;se is :), ez&eacute;rt n&eacute;zz&uuml;k &aacute;t, milyen előny&ouml;ket ad a <a href="http://docs.oracle.com/javase/tutorial/essential/io/fileio.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">NIO.2</a>, amely alapvetően a Java eddigi f&aacute;jlrendszer modellj&eacute;t bőv&iacute;ti ki az al&aacute;bbiakkal:</p>
                                                <ul>
                                                    <li style="font-size: 13px">Platform f&uuml;ggetlen f&aacute;jlrendszer modell</li>
                                                    <li style="font-size: 13px">F&aacute;jlrendszer-fa felt&eacute;rk&eacute;pez&eacute;s</li>
                                                    <li style="font-size: 13px">Az &aacute;llom&aacute;nyműveletek atomi t&aacute;mogat&aacute;sa (m&aacute;sol&aacute;s, t&ouml;rl&eacute;s, mozgat&aacute;s)</li>
                                                    <li style="font-size: 13px">Soft- &eacute;s hard-link t&aacute;mogat&aacute;s</li>
                                                    <li style="font-size: 13px">F&aacute;jl attrib&uacute;tumok kezel&eacute;se</li>
                                                    <li style="font-size: 13px">V&aacute;ltoz&aacute;s k&ouml;vet&eacute;s</li>
                                                    <li style="font-size: 13px">SPI t&aacute;mogat&aacute;s</li>
                                                </ul>
                                                <p style="font-size: 13px">N&eacute;zz&uuml;k ezeket egyenk&eacute;nt... <img class="emoticon emoticon-smile" src="/s/en_GB/3284/7/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)" /></p>
                                                <h2 id="NIO2-Platformf&uuml;ggetlenf&aacute;jlrendszermodell">Platform f&uuml;ggetlen f&aacute;jlrendszer modell</h2>
                                                <p style="font-size: 13px">A Java7 NIO.2 kapcs&aacute;n ker&uuml;lt bevezet&eacute;sre a <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">Path</a> oszt&aacute;ly, amely az eddigi megold&aacute;sok mellett lehetőv&eacute; teszi az el&eacute;r&eacute;si &uacute;tvonalak platformra val&oacute; ford&iacute;t&aacute;s&aacute;t. Eml&eacute;kezz&uuml;nk: egy csom&oacute; probl&eacute;m&aacute;nk volt abb&oacute;l, hogy <em>Unix like</em> rendszereken a f&aacute;jlrendszer kiindul&oacute; pontja a <em>/</em> volt, m&iacute;g Windows &eacute;s Windows f&aacute;jlkezel&eacute;s&eacute;t emul&aacute;l&oacute; rendszerek (eml&eacute;keim szerint p&eacute;ld&aacute;ul a Symbian) eset&eacute;n voltak meghajt&oacute;k, &iacute;gy t&ouml;bb gy&ouml;kere is volt a f&aacute;jlrendszereknek, illetve az el&eacute;r&eacute;si &uacute;tvonalon a szinteket elv&aacute;laszt&oacute; jel a / helyett a \ volt, &iacute;gy a multiplatformos programjaink tele voltak platformf&uuml;ggő el&aacute;gaz&aacute;sokkal, illetve File.separator &ouml;sszefűz&eacute;sekkel. Nem besz&eacute;lve a soft- &eacute;s hard-link t&aacute;mogat&aacute;sr&oacute;l, a val&oacute;di el&eacute;r&eacute;si &uacute;t felder&iacute;t&eacute;s&eacute;ről &eacute;s a t&ouml;bbi apr&oacute;s&aacute;gr&oacute;l... Na, ennek v&eacute;gre v&eacute;ge... <img class="emoticon emoticon-smile" src="/s/en_GB/3284/7/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)" /></p>
                                                <h2 id="NIO2-F&aacute;jlrendszer-fafelt&eacute;rk&eacute;pez&eacute;s">F&aacute;jlrendszer-fa felt&eacute;rk&eacute;pez&eacute;s</h2>
                                                <p style="font-size: 13px">A f&aacute;jlrendszer-fa felt&eacute;rk&eacute;pez&eacute;se azon ig&eacute;nyek egyike, amelyre eddig m&eacute;g nem volt sz&uuml;ks&eacute;gem, de &ouml;r&uuml;l&ouml;k, hogy a NIO.2 ezt m&aacute;r t&aacute;mogatja, az alkalmaz&aacute;s szerverek, illetve a k&uuml;l&ouml;nf&eacute;le szerver oldali Java megold&aacute;sok fejlesztői nyilv&aacute;n &ouml;r&uuml;lnek egy ilyen lehetős&eacute;gnek. A m&oacute;dszer a Visitor minta alapj&aacute;n &eacute;p&uuml;l fel, ez&eacute;rt hozzunk l&eacute;tre egy saj&aacute;t Visitor-t, amely egyszerűen csak ki&iacute;rja a kapott Path p&eacute;ld&aacute;nyt:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">public class FileVisitor extends SimpleFileVisitor&lt;Path&gt;
{

  @Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
  {
    System.out.println(file);
    return FileVisitResult.CONTINUE;
  }
}</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Ezek ut&aacute;n m&aacute;r csak meg kell h&iacute;vnunk:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">Path basePath = Paths.get(&quot;.&quot;);
try
{
  Files.walkFileTree(basePath, new FileVisitor());
} catch (IOException ex)
{
  Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Az eredm&eacute;ny nem marad el:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">./pom.xml
./src/test/java/hu/javaforum/testproject/AppTest.java
./src/main/java/hu/javaforum/testproject/App.java
./target/classes/hu/javaforum/testproject/App$FileVisitor.class
./target/classes/hu/javaforum/testproject/App$1.class
./target/classes/hu/javaforum/testproject/App.class</pre>
                                                    </div>
                                                </div>
                                                <h2 id="NIO2-Az&aacute;llom&aacute;nyműveletekatomit&aacute;mogat&aacute;sa">Az &aacute;llom&aacute;nyműveletek atomi t&aacute;mogat&aacute;sa</h2>
                                                <p style="font-size: 13px">Sajnos a Java hetes verzi&oacute;ig kellett v&aacute;rnunk arra, hogy egy f&aacute;jlt &aacute;t tudjunk mozgatni vagy ak&aacute;r csak &aacute;tnevezni... ez is m&aacute;r a m&uacute;lt&eacute;... <img class="emoticon emoticon-smile" src="/s/en_GB/3284/7/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)" /></p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">&gt; ls -l /tmp/test*
-rw-r--r-- 1 auth.gabor users 5 aug   12 12.30 /tmp/test</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Tekints&uuml;k a fenti egy darab &aacute;llom&aacute;nyt, amelyet szeretn&eacute;nk &aacute;tm&aacute;solni <em>test2</em> n&eacute;vre, majd &aacute;tnevezni <em>test3</em> n&eacute;vre:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">Path srcFile = Paths.get(&quot;/tmp/test&quot;);
Path dstFile = Paths.get(&quot;/tmp/test2&quot;);
Path moveFile = Paths.get(&quot;/tmp/test3&quot;);
Files.copy(srcFile, dstFile, StandardCopyOption.COPY_ATTRIBUTES);
Files.move(srcFile, moveFile, StandardCopyOption.ATOMIC_MOVE);</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">&Eacute;s az eredm&eacute;ny nem marad el:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">&gt; ls -l /tmp/test*
-rw-r--r-- 1 auth.gabor users 5 aug   12 12.30 /tmp/test2
-rw-r--r-- 1 auth.gabor users 5 aug   12 12.30 /tmp/test3</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Ez Java7 előtt egy t&ouml;bb tucat soros var&aacute;zslatra volt sz&uuml;ks&eacute;g egy ilyen ig&eacute;ny teljes&iacute;t&eacute;s&eacute;hez.</p>
                                                <h2 id="NIO2-Soft-&eacute;shard-linkt&aacute;mogat&aacute;s">Soft- &eacute;s hard-link t&aacute;mogat&aacute;s</h2>
                                                <p style="font-size: 13px">A NIO.2 előtt erre nem volt lehetős&eacute;g, nem lehetett meg&aacute;llap&iacute;tani egy el&eacute;r&eacute;si &uacute;tr&oacute;l, hogy az tartalmaz-e linkeket vagy sem, most m&aacute;r vannak eszk&ouml;zeink.</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">&gt; ls -l /tmp/test*
-rw-r--r-- 1 auth.gabor users 5 aug   12 12.30 /tmp/test</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Hozzunk l&eacute;tre egy soft- (symbolic-) &eacute;s egy hard-linket:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">Path srcFile = Paths.get(&quot;/tmp/test&quot;);
Path softLinkFile = Paths.get(&quot;/tmp/test2&quot;);
Path hardLinkFile = Paths.get(&quot;/tmp/test3&quot;);
Files.createSymbolicLink(softLinkFile, srcFile);
Files.createLink(hardLinkFile, srcFile);

System.out.println(&quot;isSymbolicLink:&quot;);
System.out.println(srcFile + &quot;: &quot; + Files.isSymbolicLink(srcFile));
System.out.println(softLinkFile + &quot;: &quot; + Files.isSymbolicLink(softLinkFile));
System.out.println(hardLinkFile + &quot;: &quot; + Files.isSymbolicLink(hardLinkFile));</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Az eredm&eacute;ny nem marad el:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">isSymbolicLink:
/tmp/test: false
/tmp/test2: true
/tmp/test3: false</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">A f&aacute;jlrendszern&eacute;l is l&aacute;tszik az &aacute;tlinkel&eacute;s, illetve a link sz&aacute;ml&aacute;l&oacute; a hard-link eset&eacute;n:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">&gt; ls -l /tmp/test*
-rw-r--r-- 2 auth.gabor users 5 aug   12 12.30 /tmp/test
lrwxrwxrwx 1 auth.gabor users 9 aug   12 12.44 /tmp/test2 -&gt; /tmp/test
-rw-r--r-- 2 auth.gabor users 5 aug   12 12.30 /tmp/test3</pre>
                                                    </div>
                                                </div>
                                                <h2 id="NIO2-F&aacute;jlattrib&uacute;tumokkezel&eacute;se">F&aacute;jl attrib&uacute;tumok kezel&eacute;se</h2>
                                                <p style="font-size: 13px">Ha le szeretn&eacute;nk k&eacute;rdezni egy adott f&aacute;jl attrib&uacute;tumait, akkor a legt&ouml;bb p&eacute;ld&aacute;ban megeml&iacute;t&eacute;sre ker&uuml;l a JNI vagy a sz&eacute;tt&aacute;rt k&eacute;z, mivel erre t&uacute;l sok eszk&ouml;z&uuml;nk nem volt a Java platformot tekintve, s sajnos a megfelelő megold&aacute;sra eg&eacute;szen a Java7 megjelen&eacute;s&eacute;ig v&aacute;rnunk kellett. A fentiekhez hasonl&oacute;an a megold&aacute;s egyszerű, csak azt kell eld&ouml;nten&uuml;nk, hogy milyen attrib&uacute;tumokat szeretn&eacute;nk kiolvasni (a teljess&eacute;g ig&eacute;nye n&eacute;lk&uuml;l):</p>
                                                <ul>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/BasicFileAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">BasicFileAttributeView</a></li>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/DosFileAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">DosFileAttributeView</a></li>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFileAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">PosixFileAttributeView</a></li>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/UserDefinedFileAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">UserDefinedFileAttributeView</a></li>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/AclFileAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">AclFileAttributeView</a></li>
                                                    <li style="font-size: 13px"><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/FileOwnerAttributeView.html" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none">FileOwnerAttributeView</a></li>
                                                </ul>
                                                <p style="font-size: 13px">Fogjunk egy megfelelő &aacute;ldozatot &eacute;s vallassuk ki:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">BasicFileAttributes bfa = Files.readAttributes(srcFile, BasicFileAttributes.class);
DosFileAttributes dfa = Files.readAttributes(srcFile, DosFileAttributes.class);
PosixFileAttributes pfa = Files.readAttributes(srcFile, PosixFileAttributes.class);

AclFileAttributeView afa = Files.getFileAttributeView(srcFile, AclFileAttributeView.class);
FileOwnerAttributeView foa = Files.getFileAttributeView(srcFile, FileOwnerAttributeView.class);

System.out.println(&quot;BasicFileAttributes:&quot;);
System.out.println(srcFile + &quot;:creationTime &quot; + bfa.creationTime());
System.out.println(srcFile + &quot;:isDirectory &quot; + bfa.isDirectory());
System.out.println(srcFile + &quot;:isOther &quot; + bfa.isOther());
System.out.println(srcFile + &quot;:isRegularFile &quot; + bfa.isRegularFile());
System.out.println(srcFile + &quot;:isSymbolicLink &quot; + bfa.isSymbolicLink());
System.out.println(srcFile + &quot;:lastAccessTime &quot; + bfa.lastAccessTime());
System.out.println(srcFile + &quot;:lastModifiedTime &quot; + bfa.lastModifiedTime());
System.out.println(srcFile + &quot;:size &quot; + bfa.size());

System.out.println(&quot;DosFileAttributes:&quot;);
System.out.println(srcFile + &quot;:isArchive &quot; + dfa.isArchive());
System.out.println(srcFile + &quot;:isHidden &quot; + dfa.isHidden());
System.out.println(srcFile + &quot;:isReadOnly &quot; + dfa.isReadOnly());
System.out.println(srcFile + &quot;:isSystem &quot; + dfa.isSystem());

System.out.println(&quot;PosixFileAttributes:&quot;);
System.out.println(srcFile + &quot;:group &quot; + pfa.group());
System.out.println(srcFile + &quot;:owner &quot; + pfa.owner());
System.out.println(srcFile + &quot;:permissions &quot; + pfa.permissions());

System.out.println(&quot;AclFileAttributeView:&quot;);
if (afa != null)
{
  System.out.println(srcFile + &quot;:getAcl &quot; + afa.getAcl());
}

System.out.println(&quot;FileOwnerAttributeView:&quot;);
if (foa != null)
{
  System.out.println(srcFile + &quot;:getOwner &quot; + foa.getOwner());
}</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Majd n&eacute;zz&uuml;k meg, mit mes&eacute;lt mag&aacute;r&oacute;l:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">BasicFileAttributes:
/tmp/test:creationTime 2012-08-12T10:30:39Z
/tmp/test:isDirectory false
/tmp/test:isOther false
/tmp/test:isRegularFile true
/tmp/test:isSymbolicLink false
/tmp/test:lastAccessTime 2012-08-12T10:33:09Z
/tmp/test:lastModifiedTime 2012-08-12T10:30:39Z
/tmp/test:size 5
DosFileAttributes:
/tmp/test:isArchive false
/tmp/test:isHidden false
/tmp/test:isReadOnly false
/tmp/test:isSystem false
PosixFileAttributes:
/tmp/test:group users
/tmp/test:owner auth.gabor
/tmp/test:permissions [GROUP_READ, OTHERS_READ, OWNER_WRITE, OWNER_READ]
AclFileAttributeView:
FileOwnerAttributeView:
/tmp/test:getOwner auth.gabor</pre>
                                                    </div>
                                                </div>
                                                <h2 id="NIO2-V&aacute;ltoz&aacute;sk&ouml;vet&eacute;s">V&aacute;ltoz&aacute;s k&ouml;vet&eacute;s</h2>
                                                <p style="font-size: 13px">A f&aacute;jlrendszerben t&ouml;rt&eacute;nt v&aacute;ltoz&aacute;sok figyel&eacute;se fontos feladat, gondoljunk csak a kedvenc fejlesztők&ouml;rnyezet&uuml;nkre, amely szeretne &eacute;rtes&uuml;lni arr&oacute;l, hogy a h&aacute;ta m&ouml;g&ouml;tt m&oacute;dos&iacute;tunk egy &aacute;llom&aacute;nyt. A Java7 előtt erre k&uuml;l&ouml;nf&eacute;le praktik&aacute;kra volt sz&uuml;ks&eacute;g, de ez is a m&uacute;lt&eacute;... <img class="emoticon emoticon-smile" src="/s/en_GB/3284/7/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)" /></p>
                                                <p style="font-size: 13px">Tegy&uuml;k fel, hogy szeretn&eacute;nk figyelni a /tmp/nio.2/ k&ouml;nyvt&aacute;r tartalm&aacute;ban be&aacute;ll&oacute; m&oacute;dosul&aacute;sokat:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: true" style="font-size:12px;; font-size: 13px">Path tmpDir = Paths.get(&quot;/tmp/nio.2/&quot;);
WatchService watcher = FileSystems.getDefault().newWatchService();

tmpDir.register(watcher,
        StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE,
        StandardWatchEventKinds.ENTRY_MODIFY);

while (true)
{
  WatchKey key = null;
  try
  {
    key = watcher.take();
  } catch (InterruptedException ex)
  {
    Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
  }

  for (WatchEvent event : key.pollEvents())
  {
    System.out.println(event.context() + &quot;: &quot; + event.kind());
  }

  key.reset();
}</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">A fenti program szerkezete viszonylag egyszerű, megmondjuk, hogy mit szeretn&eacute;nk figyelni, regisztr&aacute;ljuk a figyelő szolg&aacute;ltat&aacute;sba, majd egy <em>v&eacute;gtelen</em> ciklusban figyelj&uuml;k az esem&eacute;nyek bek&ouml;vetkezt&eacute;t. Pr&oacute;b&aacute;ljuk ki:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">&gt; touch /tmp/nio.2/test
&gt; rm /tmp/nio.2/test
&gt; touch /tmp/nio.2/test2
&gt; echo &quot;abc&quot; &gt;/tmp/nio.2/test2
&gt; rm /tmp/nio.2/test2</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">Ezzel egy időben az al&aacute;bbit kell l&aacute;ssuk a programunk kimenet&eacute;n:</p>
                                                <div class="code panel" style="border-width: 1px;">
                                                    <div class="codeContent panelContent">
                                                        <pre class="theme: Default; brush: java; gutter: false" style="font-size:12px;; font-size: 13px">test: ENTRY_CREATE
test: ENTRY_MODIFY
test: ENTRY_DELETE
test2: ENTRY_CREATE
test2: ENTRY_MODIFY
test2: ENTRY_MODIFY
test2: ENTRY_DELETE</pre>
                                                    </div>
                                                </div>
                                                <p style="font-size: 13px">&Uacute;gy gondolom, hogy sok Java fejlesztő nem fogja haszn&aacute;lni a fenti megold&aacute;sokat, mivel ahhoz az kellene, hogy a Java platform desktop k&ouml;rnyezetben is terjedjen el, de jelenleg nem tudunk t&uacute;l sok p&eacute;ld&aacute;t mondani multiplatformos programra.</p>
                                                <hr />
                                                <p style="font-size: 13px">
                                                    <style type="text/css">
    .rater {
        color: #949494;
        font-size: 11px;
        margin: 4px 4px;
        overflow: auto;
    }
    .rater td {
        vertical-align: middle;
        padding-top: 6px;
    }
    .rater .images {
        padding-top: 3px;
    }
    .rater .links {
        cursor: pointer;
    }
    .rater .disabled a {
        cursor: default;
    }
    .rater img {
        height: 18px;
        width: 15px;
    }
    .rater .wait img {
        height: 18px;
        width: 20px;
        background: transparent url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/loading_mini.gif) no-repeat scroll center left;
    }
    .rater a img {
        border-style: none;
    }
    .results.caption {
        padding-left: 8px;
    }
    .rater .right-space {
        padding-right: 8px;
    }

    /* sprites */
    .rater img { background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; }
    .rater a.out img { background-position: 0 -275px; }
    .rater a.over img, .rater img.over { background-position: 0 -226px; }
    .rater a.off img, .rater img.off { background-position: 0 -128px; }
    .rater a.on img, .rater img.on { background-position: 0 -177px; }
    .rater img.half { background-position: 0 -79px; }

                                                    </style> <img width="0px" height="0px" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/loading_mini.gif" /> <img width="0px" height="0px" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif" /> </p>
                                                <!-- only output the .vote td's if they CAN vote, but have NOT yet voted -->
                                                <!-- obviously change the URL's on the a tags to reflect the various choices -->
                                                <!-- only output the .wait td's if they CAN vote, but haven't already voted -->
                                                <!-- always output .results td's - the classes (on, half and off) depict the current avg. rating -->
                                                <!--td>&nbsp;&nbsp;&nbsp;&nbsp;<a id="activatePlusone-27852934" href="#"
                onClick="gapi.plusone.render('plusone-div-27852934');document.getElementById('activatePlusone-27852934').style.display='none';">Activate the +1 button</a>
                <div id="plusone-div-27852934"></div>
        </td-->
                                                <table class="rater ceoId-27852934" style="color: #949494; font-size: 11px; margin: 4px 4px; overflow: auto">
                                                    <tbody>
                                                        <tr>
                                                            <!-- only output the .vote td's if they CAN vote, but have NOT yet voted -->
                                                            <td class="vote caption" style="font-size: 13px; vertical-align: middle; padding-top: 6px">Your Rating:</td>
                                                            <td class="vote thanks" style="display:none;; font-size: 13px; vertical-align: middle; padding-top: 6px">Thanks for voting!</td>
                                                            <!-- obviously change the URL's on the a tags to reflect the various choices -->
                                                            <td class="vote links images right-space" style="font-size: 13px; vertical-align: middle; padding-top: 6px; padding-top: 3px; cursor: pointer; padding-right: 8px"> <a class="out" href="/plugins/rate/rating.action?decorator=none&amp;displayFilter.includeCookies=true&amp;displayFilter.includeUsers=true&amp;ceoId=27852934&amp;rating=1&amp;redirect=true" alt="Pathetic" title="Pathetic" style="color: #326ca6; text-decoration: none"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" style="height: 18px; width: 15px; border-style: none; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -275px" /></a><a class="out" href="/plugins/rate/rating.action?decorator=none&amp;displayFilter.includeCookies=true&amp;displayFilter.includeUsers=true&amp;ceoId=27852934&amp;rating=2&amp;redirect=true" alt="Bad" title="Bad" style="color: #326ca6; text-decoration: none"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" style="height: 18px; width: 15px; border-style: none; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -275px" /></a><a class="out" href="/plugins/rate/rating.action?decorator=none&amp;displayFilter.includeCookies=true&amp;displayFilter.includeUsers=true&amp;ceoId=27852934&amp;rating=3&amp;redirect=true" alt="OK" title="OK" style="color: #326ca6; text-decoration: none"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" style="height: 18px; width: 15px; border-style: none; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -275px" /></a><a class="out" href="/plugins/rate/rating.action?decorator=none&amp;displayFilter.includeCookies=true&amp;displayFilter.includeUsers=true&amp;ceoId=27852934&amp;rating=4&amp;redirect=true" alt="Good" title="Good" style="color: #326ca6; text-decoration: none"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" style="height: 18px; width: 15px; border-style: none; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -275px" /></a><a class="out" href="/plugins/rate/rating.action?decorator=none&amp;displayFilter.includeCookies=true&amp;displayFilter.includeUsers=true&amp;ceoId=27852934&amp;rating=5&amp;redirect=true" alt="Outstanding!" title="Outstanding!" style="color: #326ca6; text-decoration: none"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" style="height: 18px; width: 15px; border-style: none; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -275px" /></a> </td>
                                                            <!-- only output the .wait td's if they CAN vote, but haven't already voted -->
                                                            <td class="wait images" style="display:none;; font-size: 13px; vertical-align: middle; padding-top: 6px; padding-top: 3px"><img src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="Please Wait" title="Please Wait" style="height: 18px; width: 15px; height: 18px; width: 20px; background: transparent url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/loading_mini.gif) no-repeat scroll center left; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left" /></td>
                                                            <td class="wait text right-space" style="display:none;; font-size: 13px; vertical-align: middle; padding-top: 6px; padding-right: 8px">Please Wait</td>
                                                            <!-- always output .results td's - the classes (on, half and off) depict the current avg. rating -->
                                                            <td class="results caption border" style="font-size: 13px; vertical-align: middle; padding-top: 6px; padding-left: 8px">Results:</td>
                                                            <td class="results images" style="font-size: 13px; vertical-align: middle; padding-top: 6px; padding-top: 3px"> <img class="off" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="Pathetic" title="Pathetic" style="height: 18px; width: 15px; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -128px" /><img class="off" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="Bad" title="Bad" style="height: 18px; width: 15px; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -128px" /><img class="off" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="OK" title="OK" style="height: 18px; width: 15px; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -128px" /><img class="off" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="Good" title="Good" style="height: 18px; width: 15px; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -128px" /><img class="off" src="/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/blank.gif" alt="Outstanding!" title="Outstanding!" style="height: 18px; width: 15px; background: url(/download/resources/com.adaptavist.confluence.rate:rate/resources/themes/v2/gfx/rater.gif) no-repeat top left; background-position: 0 -128px" /> </td>
                                                            <td class="results value" style="font-size: 13px; vertical-align: middle; padding-top: 6px">0</td>
                                                            <td class="results ratings" style="font-size: 13px; vertical-align: middle; padding-top: 6px">rates</td>
                                                            <!--td>&nbsp;&nbsp;&nbsp;&nbsp;<a id="activatePlusone-27852934" href="#"
                onClick="gapi.plusone.render('plusone-div-27852934');document.getElementById('activatePlusone-27852934').style.display='none';">Activate the +1 button</a>
                <div id="plusone-div-27852934"></div>
        </td-->
                                                            <td class="results" style="font-size: 13px; vertical-align: middle; padding-top: 6px">&nbsp; &nbsp;</td>
                                                            <td style="font-size: 13px; vertical-align: middle; padding-top: 6px">
                                                                <g:plusone></g:plusone></td>
                                                            <td class="results" style="font-size: 13px; vertical-align: middle; padding-top: 6px">&nbsp; &nbsp;</td>
                                                            <td style="font-size: 13px; vertical-align: middle; padding-top: 6px">
                                                                <div class="fb-like" data-send="true" data-layout="button_count" data-width="450" data-show-faces="true"></div></td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                                <p style="font-size: 13px"></p>
                                                <p style="font-size: 13px"> </p>
                                                <div class="bv_viewtracker">
                                                    <span class="bv_viewracker_span bv_viewtracker_closed"> Page viewed 1 times by 1 users since Aug 12, 2012 </span>
                                                </div>
                                                <div class="bv_viewtracker_visits" style="display:none;">
                                                    <table class="bv_viewtracker_table tableview attachments">
                                                        <tbody>
                                                            <tr class="bv_viewtracker_header">
                                                                <th class="bv_viewtracker_header_name" style="font-size: 13px; border-bottom: 1px solid #69c; font-weight: bold; text-align: left">Name</th>
                                                                <th class="bv_viewtracker_header_lastviewed" style="font-size: 13px; border-bottom: 1px solid #69c; font-weight: bold; text-align: left">Last viewed</th>
                                                                <th class="bv_viewtracker_header_timesviewed" style="font-size: 13px; border-bottom: 1px solid #69c; font-weight: bold; text-align: left">Times viewed</th>
                                                            </tr>
                                                            <tr class="bv_viewtracker_body">
                                                                <td class="bv_viewtracker_body_name" style="font-size: 13px; border-bottom: 1px solid #bbb; text-align: left; padding: 4px 16px 4px 0"> <a href="/display/~javalist" class="url fn confluence-userlink" data-username="javalist" style="color: #326ca6; text-decoration: none">Javaforum List</a><br /> </td>
                                                                <td class="bv_viewtracker_body_lastviewed" style="font-size: 13px; border-bottom: 1px solid #bbb; text-align: left; padding: 4px 16px 4px 0">Aug 12, 2012 13:38</td>
                                                                <td class="bv_viewtracker_body_timesviewed" style="font-size: 13px; border-bottom: 1px solid #bbb; text-align: left; padding: 4px 16px 4px 0">1</td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                                <p style="font-size: 13px"></p>
                                                <p style="font-size: 13px">&nbsp;</p>
                                            </div>
                                        </div>
                                        <table id="email-actions" class="email-metadata" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-top: 1px solid #bbb; color: #505050; margin: 8px 0 0 0; padding: 0; color: #505050">
                                            <tbody>
                                                <tr>
                                                    <td class="left" valign="top" style="font-size: 13px; padding-top: 8px; max-width: 45%; text-align: left"> <span class="email-list-item"><a href="http://wiki.javaforum.hu/display/JAVAFORUM/2012/08/12/NIO.2" style="color: #326ca6; text-decoration: none">View Online</a> </span> </td>
                                                    <td class="right" width="50%" valign="top" style="font-size: 13px; padding-top: 8px; text-align: right"> <span class="email-list-item"><a href="http://wiki.javaforum.hu/users/editmyemailsettings.action" style="color: #326ca6; text-decoration: none">Manage Notifications</a> </span> <span class="email-list-divider" style="color: #505050; padding: 0 0.350em">&middot;</span> <span class="email-list-item"><a href="http://wiki.javaforum.hu/users/viewmyemailsettings.action" style="color: #326ca6; text-decoration: none">Unsubscribe from all blog posts</a> </span> </td>
                                                </tr>
                                            </tbody>
                                        </table> </td>
                                </tr>
                            </tbody>
                        </table></td>
                </tr>
                <tr>
                    <td id="email-footer" align="center" style="font-size: 13px; padding: 0 16px 32px 16px; margin: 0"> <small style="font-size: 11px"> This message was sent by <a class="email-footer-link" style="color:#505050;font-size:11px;text-decoration:none;; color: #326ca6; text-decoration: none; color: #505050; font-size: 11px" href="http://www.atlassian.com/software/confluence">Atlassian Confluence</a> 4.2.5, the <a class="email-footer-link" style="color:#505050;font-size:11px;text-decoration:none;; color: #326ca6; text-decoration: none; color: #505050; font-size: 11px" href="http://www.atlassian.com/software/confluence/tour/enterprise-wiki.jsp">Enterprise Wiki</a> </small> </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>