java.lang.Object
com.aoapps.lang.io.IoUtils
I/O utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic char
bufferToChar
(byte[] ioBuffer) static char
bufferToChar
(byte[] ioBuffer, int off) static int
bufferToInt
(byte[] ioBuffer) static int
bufferToInt
(byte[] ioBuffer, int off) static long
bufferToLong
(byte[] ioBuffer) static long
bufferToLong
(byte[] ioBuffer, int off) static short
bufferToShort
(byte[] ioBuffer) static short
bufferToShort
(byte[] ioBuffer, int off) static void
charToBuffer
(char ch, byte[] ioBuffer) static void
charToBuffer
(char ch, byte[] ioBuffer, int off) static boolean
contentEquals
(InputStream in, byte[] contents) Compares the contents retrieved from an InputStream to the provided contents.static long
copy
(InputStream in, OutputStream out) copies without flush.static long
copy
(InputStream in, OutputStream out, boolean flush) Copies all information from one stream to another.static long
Copies all information from one stream to another.static long
copy
(Reader in, Appendable out) Copies all information from one stream to an appendable.static long
copy
(Reader in, StringBuilder out) Copies all information from one stream to another.static void
intToBuffer
(int i, byte[] ioBuffer) static void
intToBuffer
(int i, byte[] ioBuffer, int off) static void
longToBuffer
(long l, byte[] ioBuffer) static void
longToBuffer
(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 void
readFully
(InputStream in, byte[] buffer) readFully for any stream.static void
readFully
(InputStream in, byte[] buffer, int off, int len) readFully for any stream.static String
Reads a reader fully (to end of stream), returning a String of the content read.static void
shortToBuffer
(short s, byte[] ioBuffer) static void
shortToBuffer
(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)
-