类 ConcurrentDiskUtil


  • public class ConcurrentDiskUtil
    extends java.lang.Object
    concurrent disk util;op file with file lock.
    作者:
    configCenter
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      private static org.slf4j.Logger LOGGER  
      private static java.lang.String READ_ONLY  
      private static java.lang.String READ_WRITE  
      (专用程序包) static int RETRY_COUNT  
      (专用程序包) static int SLEEP_BASETIME
      ms.
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.lang.String byteBufferToString​(java.nio.ByteBuffer buffer, java.lang.String charsetName)
      transfer ByteBuffer to String.
      static java.lang.String getFileContent​(java.io.File file, java.lang.String charsetName)
      get file content.
      static java.lang.String getFileContent​(java.lang.String path, java.lang.String charsetName)
      get file content.
      private static void sleep​(int time)  
      static java.lang.Boolean writeFileContent​(java.io.File file, java.lang.String content, java.lang.String charsetName)
      write file content.
      static java.lang.Boolean writeFileContent​(java.lang.String path, java.lang.String content, java.lang.String charsetName)
      write file content.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • SLEEP_BASETIME

        static final int SLEEP_BASETIME
        ms.
        另请参阅:
        常量字段值
      • READ_ONLY

        private static final java.lang.String READ_ONLY
        另请参阅:
        常量字段值
      • READ_WRITE

        private static final java.lang.String READ_WRITE
        另请参阅:
        常量字段值
    • 构造器详细资料

      • ConcurrentDiskUtil

        public ConcurrentDiskUtil()
    • 方法详细资料

      • getFileContent

        public static java.lang.String getFileContent​(java.lang.String path,
                                                      java.lang.String charsetName)
                                               throws java.io.IOException
        get file content.
        参数:
        path - file path
        charsetName - charsetName
        返回:
        content
        抛出:
        java.io.IOException - IOException
      • getFileContent

        public static java.lang.String getFileContent​(java.io.File file,
                                                      java.lang.String charsetName)
                                               throws java.io.IOException
        get file content.
        参数:
        file - file
        charsetName - charsetName
        返回:
        content
        抛出:
        java.io.IOException - IOException
      • writeFileContent

        public static java.lang.Boolean writeFileContent​(java.lang.String path,
                                                         java.lang.String content,
                                                         java.lang.String charsetName)
                                                  throws java.io.IOException
        write file content.
        参数:
        path - file path
        content - content
        charsetName - charsetName
        返回:
        whether write ok
        抛出:
        java.io.IOException - IOException
      • writeFileContent

        public static java.lang.Boolean writeFileContent​(java.io.File file,
                                                         java.lang.String content,
                                                         java.lang.String charsetName)
                                                  throws java.io.IOException
        write file content.
        参数:
        file - file
        content - content
        charsetName - charsetName
        返回:
        whether write ok
        抛出:
        java.io.IOException - IOException
      • byteBufferToString

        public static java.lang.String byteBufferToString​(java.nio.ByteBuffer buffer,
                                                          java.lang.String charsetName)
                                                   throws java.io.IOException
        transfer ByteBuffer to String.
        参数:
        buffer - buffer
        charsetName - charsetName
        返回:
        String
        抛出:
        java.io.IOException - IOException
      • sleep

        private static void sleep​(int time)