public class IOUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static ByteBuffer |
clone(ByteBuffer original) |
static PathPrivilege |
readPathPrivilege(DataInputStream inputStream,
String encoding,
ThreadLocal<byte[]> strBufferLocal)
Read a PathPrivilege from the given stream.
|
static String |
readString(DataInputStream inputStream,
String encoding,
ThreadLocal<byte[]> strBufferLocal)
Read a string from the given stream.
|
static void |
replaceFile(File newFile,
File oldFile)
Replace newFile with oldFile.
|
static void |
writeInt(OutputStream outputStream,
int i,
ThreadLocal<ByteBuffer> encodingBufferLocal)
Write an integer into the given stream.
|
static void |
writePathPrivilege(OutputStream outputStream,
PathPrivilege pathPrivilege,
String encoding,
ThreadLocal<ByteBuffer> encodingBufferLocal)
Write a PathPrivilege to the given stream.
|
static void |
writeString(OutputStream outputStream,
String str,
String encoding,
ThreadLocal<ByteBuffer> encodingBufferLocal)
Write a string into the given stream.
|
public static void writeString(OutputStream outputStream, String str, String encoding, ThreadLocal<ByteBuffer> encodingBufferLocal) throws IOException
outputStream - the destination to insert.str - the string to be written.encoding - string encoding like 'utf-8'.encodingBufferLocal - a ThreadLocal buffer may be passed to avoid frequently memory
allocations. A null may also be passed to use a local buffer.IOException - when an exception raised during operating the stream.public static void writeInt(OutputStream outputStream, int i, ThreadLocal<ByteBuffer> encodingBufferLocal) throws IOException
outputStream - the destination to insert.i - the integer to be written.encodingBufferLocal - a ThreadLocal buffer may be passed to avoid frequently memory
allocations. A null may also be passed to use a local buffer.IOException - when an exception raised during operating the stream.public static String readString(DataInputStream inputStream, String encoding, ThreadLocal<byte[]> strBufferLocal) throws IOException
inputStream - the source to read.encoding - string encoding like 'utf-8'.strBufferLocal - a ThreadLocal buffer may be passed to avoid frequently memory
allocations. A null may also be passed to use a local buffer.IOException - when an exception raised during operating the stream.public static PathPrivilege readPathPrivilege(DataInputStream inputStream, String encoding, ThreadLocal<byte[]> strBufferLocal) throws IOException
inputStream - the source to read.encoding - string encoding like 'utf-8'.strBufferLocal - a ThreadLocal buffer may be passed to avoid frequently memory
allocations. A null may also be passed to use a local buffer.IOException - when an exception raised during operating the stream.public static void writePathPrivilege(OutputStream outputStream, PathPrivilege pathPrivilege, String encoding, ThreadLocal<ByteBuffer> encodingBufferLocal) throws IOException
outputStream - the destination to insert.pathPrivilege - the PathPrivilege to be written.encoding - string encoding like 'utf-8'.encodingBufferLocal - a ThreadLocal buffer may be passed to avoid frequently memory
allocations. A null may also be passed to use a local buffer.IOException - when an exception raised during operating the stream.public static void replaceFile(File newFile, File oldFile) throws IOException
newFile - the new file.oldFile - the file to be replaced.IOExceptionpublic static ByteBuffer clone(ByteBuffer original)
Copyright © 2022 The Apache Software Foundation. All rights reserved.