JDK

java.io.FileSystemクラス

FileSystemクラスは様々なファイルシステムを扱うための抽象クラスで,publicなメソッドは宣言のみである。実装はそれぞれのファイルシステムに対応するサブクラスで行われる。仕様についてはAPIドキュメントを参照して頂きたい。

/*
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package java.io;
import java.lang.annotation.Native;
abstract class FileSystem {
    /* — Normalization and construction — */
    public abstract char getSeparator();
    public abstract char getPathSeparator();
    public abstract String normalize(String path);
    public abstract int prefixLength(String path);
    public abstract String resolve(String parent, String child);
    public abstract String getDefaultParent();
    public abstract String fromURIPath(String path);
    /* — Path operations — */
    public abstract boolean isAbsolute(File f);
    public abstract String resolve(File f);
    public abstract String canonicalize(String path) throws IOException;
    /* — Attribute accessors — */
    /* Constants for simple boolean attributes */
    @Native public static final int BA_EXISTS    = 0x01;
    @Native public static final int BA_REGULAR   = 0x02;
    @Native public static final int BA_DIRECTORY = 0x04;
    @Native public static final int BA_HIDDEN    = 0x08;
    public abstract int getBooleanAttributes(File f);
    @Native public static final int ACCESS_READ    = 0x04;
    @Native public static final int ACCESS_WRITE   = 0x02;
    @Native public static final int ACCESS_EXECUTE = 0x01;
    public abstract boolean checkAccess(File f, int access);
    public abstract boolean setPermission(File f, int access, boolean enable, boolean owneronly);
    public abstract long getLastModifiedTime(File f);
    public abstract long getLength(File f);
    /* — File operations — */
    public abstract boolean createFileExclusively(String pathname)
        throws IOException;
    public abstract boolean delete(File f);
    public abstract String[] list(File f);
    public abstract boolean createDirectory(File f);
    public abstract boolean rename(File f1, File f2);
    public abstract boolean setLastModifiedTime(File f, long time);
    public abstract boolean setReadOnly(File f);
    /* — Filesystem interface — */
    public abstract File[] listRoots();
    /* — Disk usage — */
    @Native public static final int SPACE_TOTAL  = 0;
    @Native public static final int SPACE_FREE   = 1;
    @Native public static final int SPACE_USABLE = 2;
    public abstract long getSpace(File f, int t);
    /* — Basic infrastructure — */
    public abstract int getNameMax(String path);
    public abstract int compare(File f1, File f2);
    public abstract int hashCode(File f);
    // Flags for enabling/disabling performance optimizations for file
    // name canonicalization
    static final boolean useCanonCaches;
    static final boolean useCanonPrefixCache;
    private static boolean getBooleanProperty(String prop, boolean defaultVal) {
        String value = System.getProperty(prop);
        return (value != null) ? Boolean.parseBoolean(value) : defaultVal;
    }
    static {
        useCanonCaches      = getBooleanProperty("sun.io.useCanonCaches", false);
        useCanonPrefixCache = useCanonCaches && getBooleanProperty("sun.io.useCanonPrefixCache", false);
    }
}
未分類

UPS(無停電電源装置)バッテリー交換

 UPSのバッテリー劣化を知らせる警報が作動したため,バッテリーを交換しました。電源を入れたまま交換できるのはありがたいですね。古いバッテリーは自治体では回収してくれないので,メーカーへ送って処分してもらいます。鉛,硫酸など,危険物がいっぱい入っているから仕方ないですね。

 メーカーの製品ページはこちら。

https://www.oss.omron.co.jp/ups/product/by35-120s/by35-120s.html

 古いバッテリーを送ろうとしたら,けっこう大変でした。郵便局のコールセンターに問い合わせると,「鉛電池は禁制品になっている」と断られました。ヤマト運輸のWebにもバッテリーは不可と書いてありました。昨日新品のバッテリーを持ってきてくれた佐川急便なら拒否しないだろうと思い,問い合わせてみると,密閉容器に入っているものならOKだが,今日は集荷できないとのこと。バスに乗って佐川急便の配送拠点へ持込みました。

バッテリ交換ランプが点灯(ブザーもなっていたが停めた)
交換用のあたらしいバッテリ
UPSを開けたところ