<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yoheiM</author_name>
  <author_url>https://blog.hatena.ne.jp/yoheiM/</author_url>
  <blog_title>YoheiM技術やらずに終われまテン</blog_title>
  <blog_url>https://yoheim.hatenadiary.org/</blog_url>
  <categories>
    <anon>Java</anon>
  </categories>
  <description>とある事情で、Javaプログラムからファイルへロックを掛ける方法を考えていたので、見つけた方法を記述します。 java.nioパッケージのFileChannelとFileLockを利用する方法です。サンプルソースを載せておこっと。今度参照する機会があれば良いな。 public class FileLockSample { public static void main(String[] args) throws Exception{ final String filePath = &quot;src/filelock/target.txt&quot;; File lockFile = new File(fileP…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyoheim.hatenadiary.org%2Fentry%2F20100724&quot; title=&quot; ファイルをロックする方法 - YoheiM技術やらずに終われまテン&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-07-24 00:00:00</published>
  <title> ファイルをロックする方法</title>
  <type>rich</type>
  <url>https://yoheim.hatenadiary.org/entry/20100724</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
