OSDN Git Service

Windows特化処理の廃止
authorOlyutorskii <olyutorskii@users.osdn.me>
Wed, 24 Aug 2011 09:19:58 +0000 (18:19 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Wed, 24 Aug 2011 09:19:58 +0000 (18:19 +0900)
src/main/java/jp/sourceforge/mikutoga/corelib/WinFile.java [deleted file]

diff --git a/src/main/java/jp/sourceforge/mikutoga/corelib/WinFile.java b/src/main/java/jp/sourceforge/mikutoga/corelib/WinFile.java
deleted file mode 100644 (file)
index 2a3591e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Windows File utils
- *
- * License : The MIT License
- * Copyright(c) 2010 MikuToga Partners
- */
-
-package jp.sourceforge.mikutoga.corelib;
-
-/**
- * Windowsに特化したFileユーティリティ。
- */
-public final class WinFile {
-
-    /** パスセパレータ。 */
-    public static final char SEPARATOR_CHAR = '\\';  // \
-    /** パスセパレータ文字列。 */
-    public static final String SEPARATOR =
-            Character.toString(SEPARATOR_CHAR);
-    /** UNC 分離文字列。 */
-    public static final String PFX_UNC =
-            SEPARATOR + SEPARATOR;                   // \\
-
-    static{
-        assert '\\' == 0x005c;
-    }
-
-    /**
-     * 隠しコンストラクタ。
-     */
-    private WinFile(){
-        assert false;
-        throw new AssertionError();
-    }
-
-    /**
-     * Windowsファイル名の正規化を行う。
-     * UNCも考慮される。
-     * 相対パスは相対パスのまま。
-     * <ul>
-     * <li>頭の3回以上連続する\記号は2個の\記号に置き換えられる。
-     * <li>末尾の1回以上連続する\記号は削除。
-     * ただし頭から連続している場合は削除しない。
-     * <li>2回以上連続する\記号は1個の\記号にまとめられる。
-     * ただし頭から連続している場合はまとめない。
-     * </ul>
-     * @param seq 対象ファイル名
-     * @return 正規化されたファイル名
-     */
-    public static String normalizeWinFileName(CharSequence seq){
-        String text = seq.toString();
-        text = text.replaceAll("^\\\\{3,}", "\\\\\\\\");
-        text = text.replaceAll("(.*[^\\\\])\\\\+$", "$1");
-        text = text.replaceAll("([^\\\\])\\\\{2,}", "$1\\\\");
-        return text;
-    }
-
-}