Class ConcurrentDiskUtil


  • public class ConcurrentDiskUtil
    extends Object
    concurrent disk util;op file with file lock
    Author:
    configCenter
    • Constructor Detail

      • ConcurrentDiskUtil

        public ConcurrentDiskUtil()
    • Method Detail

      • getFileContent

        public static String getFileContent​(String path,
                                            String charsetName)
                                     throws IOException
        get file content
        Parameters:
        path - file path
        charsetName - charsetName
        Returns:
        content
        Throws:
        IOException - IOException
      • getFileContent

        public static String getFileContent​(File file,
                                            String charsetName)
                                     throws IOException
        get file content
        Parameters:
        file - file
        charsetName - charsetName
        Returns:
        content
        Throws:
        IOException - IOException
      • writeFileContent

        public static Boolean writeFileContent​(String path,
                                               String content,
                                               String charsetName)
                                        throws IOException
        write file content
        Parameters:
        path - file path
        content - content
        charsetName - charsetName
        Returns:
        whether write ok
        Throws:
        IOException - IOException
      • writeFileContent

        public static Boolean writeFileContent​(File file,
                                               String content,
                                               String charsetName)
                                        throws IOException
        write file content
        Parameters:
        file - file
        content - content
        charsetName - charsetName
        Returns:
        whether write ok
        Throws:
        IOException - IOException
      • byteBufferToString

        public static String byteBufferToString​(ByteBuffer buffer,
                                                String charsetName)
                                         throws IOException
        transfer ByteBuffer to String
        Parameters:
        buffer - buffer
        charsetName - charsetName
        Returns:
        String
        Throws:
        IOException - IOException