Class ConcurrentDiskUtil
- java.lang.Object
-
- com.alibaba.nacos.client.config.utils.ConcurrentDiskUtil
-
public class ConcurrentDiskUtil extends Object
concurrent disk util;op file with file lock- Author:
- configCenter
-
-
Constructor Summary
Constructors Constructor Description ConcurrentDiskUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbyteBufferToString(ByteBuffer buffer, String charsetName)transfer ByteBuffer to Stringstatic StringgetFileContent(File file, String charsetName)get file contentstatic StringgetFileContent(String path, String charsetName)get file contentstatic BooleanwriteFileContent(File file, String content, String charsetName)write file contentstatic BooleanwriteFileContent(String path, String content, String charsetName)write file content
-
-
-
Method Detail
-
getFileContent
public static String getFileContent(String path, String charsetName) throws IOException
get file content- Parameters:
path- file pathcharsetName- charsetName- Returns:
- content
- Throws:
IOException- IOException
-
getFileContent
public static String getFileContent(File file, String charsetName) throws IOException
get file content- Parameters:
file- filecharsetName- 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 pathcontent- contentcharsetName- 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- filecontent- contentcharsetName- 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- buffercharsetName- charsetName- Returns:
- String
- Throws:
IOException- IOException
-
-