java.lang.Object
com.aoapps.lang.io.IoUtils
I/O utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic charbufferToChar(byte[] ioBuffer) static charbufferToChar(byte[] ioBuffer, int off) static intbufferToInt(byte[] ioBuffer) static intbufferToInt(byte[] ioBuffer, int off) static longbufferToLong(byte[] ioBuffer) static longbufferToLong(byte[] ioBuffer, int off) static shortbufferToShort(byte[] ioBuffer) static shortbufferToShort(byte[] ioBuffer, int off) static voidcharToBuffer(char ch, byte[] ioBuffer) static voidcharToBuffer(char ch, byte[] ioBuffer, int off) static booleancontentEquals(InputStream in, byte[] contents) Compares the contents retrieved from an InputStream to the provided contents.static longcopy(InputStream in, OutputStream out) copies without flush.static longcopy(InputStream in, OutputStream out, boolean flush) Copies all information from one stream to another.static longCopies all information from one stream to another.static longcopy(Reader in, Appendable out) Copies all information from one stream to an appendable.static longcopy(Reader in, StringBuilder out) Copies all information from one stream to another.static voidintToBuffer(int i, byte[] ioBuffer) static voidintToBuffer(int i, byte[] ioBuffer, int off) static voidlongToBuffer(long l, byte[] ioBuffer) static voidlongToBuffer(long l, byte[] ioBuffer, int off) static byte[]readFully(InputStream in) Reads an input stream fully (to end of stream), returning a byte[] of the content read.static voidreadFully(InputStream in, byte[] buffer) readFully for any stream.static voidreadFully(InputStream in, byte[] buffer, int off, int len) readFully for any stream.static StringReads a reader fully (to end of stream), returning a String of the content read.static voidshortToBuffer(short s, byte[] ioBuffer) static voidshortToBuffer(short s, byte[] ioBuffer, int off)
-
Method Details
-
copy
copies without flush.- Throws:
IOException- See Also:
-
copy
Copies all information from one stream to another. Internally reuses thread-local buffers to avoid initial buffer zeroing cost and later garbage collection overhead.- Returns:
- the number of bytes copied
- Throws:
IOException- See Also:
-
copy
Copies all information from one stream to another. Internally reuses thread-local buffers to avoid initial buffer zeroing cost and later garbage collection overhead.- Returns:
- the number of bytes copied
- Throws:
IOException- See Also:
-
copy
Copies all information from one stream to an appendable.- Returns:
- the number of bytes copied
- Throws:
IOException- See Also:
-
copy
Copies all information from one stream to another. Internally reuses thread-local buffers to avoid initial buffer zeroing cost and later garbage collection overhead.- Returns:
- the number of bytes copied
- Throws:
IOException- See Also:
-
readFully
readFully for any stream.- Throws:
IOException
-
readFully
readFully for any stream.- Throws:
IOException
-
readFully
Reads an input stream fully (to end of stream), returning a byte[] of the content read.- Throws:
IOException
-
readFully
Reads a reader fully (to end of stream), returning a String of the content read.- Throws:
IOException
-
contentEquals
Compares the contents retrieved from an InputStream to the provided contents.- Returns:
- true when the contents exactly match
- Throws:
IOException
-
charToBuffer
public static void charToBuffer(char ch, byte[] ioBuffer) -
charToBuffer
public static void charToBuffer(char ch, byte[] ioBuffer, int off) -
bufferToChar
public static char bufferToChar(byte[] ioBuffer) -
bufferToChar
public static char bufferToChar(byte[] ioBuffer, int off) -
shortToBuffer
public static void shortToBuffer(short s, byte[] ioBuffer) -
shortToBuffer
public static void shortToBuffer(short s, byte[] ioBuffer, int off) -
bufferToShort
public static short bufferToShort(byte[] ioBuffer) -
bufferToShort
public static short bufferToShort(byte[] ioBuffer, int off) -
intToBuffer
public static void intToBuffer(int i, byte[] ioBuffer) -
intToBuffer
public static void intToBuffer(int i, byte[] ioBuffer, int off) -
bufferToInt
public static int bufferToInt(byte[] ioBuffer) -
bufferToInt
public static int bufferToInt(byte[] ioBuffer, int off) -
longToBuffer
public static void longToBuffer(long l, byte[] ioBuffer) -
longToBuffer
public static void longToBuffer(long l, byte[] ioBuffer, int off) -
bufferToLong
public static long bufferToLong(byte[] ioBuffer) -
bufferToLong
public static long bufferToLong(byte[] ioBuffer, int off)
-
