Package com.diozero.util
Class IOUtil
java.lang.Object
com.diozero.util.IOUtil
public class IOUtil extends Object
-
Constructor Summary
Constructors Constructor Description IOUtil()
-
Method Summary
Modifier and Type Method Description static int
read(InputStream is, byte[] buffer)
Attempt to read buffer.length bytes into buffer from the input steam.static void
readFully(InputStream is, byte[] buffer)
Attempt to read buffer.length bytes into buffer from the input steam, throw an exception if unable to read buffer.length bytes.
-
Constructor Details
-
IOUtil
public IOUtil()
-
-
Method Details
-
read
Attempt to read buffer.length bytes into buffer from the input steam. This implementation loops until the buffer is fully populated with data. The number of bytes actually read is returned - it may not equal buffer.length if the end of the input stream is reached.- Parameters:
is
- the input stream to read frombuffer
- the buffer to read into; the length of the buffer specifies the number of bytes to read- Returns:
- the number of bytes actually read, can be less than buffer.length if EOF is reached
- Throws:
IOException
- if a read error occurs
-
readFully
Attempt to read buffer.length bytes into buffer from the input steam, throw an exception if unable to read buffer.length bytes.- Parameters:
is
- the input stream to read frombuffer
- the buffer to read into; the length of the buffer specifies the number of bytes to read- Throws:
IOException
- if a read error occursEOFException
- if unable to read buffer.length bytes
-