public abstract class Stream
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static byte[] |
skipBuffer |
| Constructor and Description |
|---|
Stream() |
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
asInputStream() |
java.io.OutputStream |
asOutputStream() |
static Stream |
asStream(java.io.InputStream inputStream) |
static Stream |
asStream(java.io.OutputStream outputStream) |
abstract void |
close()
Closes this I/O connection, releasing any associated resources.
|
abstract int |
readBytes(byte[] buf,
int start,
int count)
Reads bytes from the stream.
|
int |
skipBytes(int n)
Skips over and discards n bytes of data from this stream.
|
java.io.InputStream |
wrapInputStream()
Deprecated.
use
asInputStream() instead |
static Stream |
wrapInputStreamToStream(java.io.InputStream inputStream)
Deprecated.
use
asStream(InputStream) instead |
int |
write(int b)
Writes a single byte to the stream.
|
int |
writeBytes(byte[] buf)
Writes bytes to the stream.
|
abstract int |
writeBytes(byte[] buf,
int start,
int count)
Writes bytes to the stream.
|
int |
writeBytes(java.lang.String string)
Writes the string to the stream as a byte array.
|
int |
writeBytes(java.lang.StringBuffer sb)
Writes the given StringBuffer as a byte array, retrieved using Convert.getBytes.
The String is written as-is, nothing is placed before or after it. |
public abstract int readBytes(byte[] buf,
int start,
int count)
throws IOException
buf - the byte array to read data intostart - the start position in the arraycount - the number of bytes to readIOExceptionpublic abstract int writeBytes(byte[] buf,
int start,
int count)
throws IOException
IOException if an error prevented the write
operation from occurring.buf - the byte array to write data fromstart - the start position in the byte arraycount - the number of bytes to writeIOExceptionpublic int writeBytes(byte[] buf)
throws IOException
IOException if an error prevented the write
operation from occurring.buf - the byte array to write data fromIOExceptionpublic int writeBytes(java.lang.String string)
throws IOException
IOException if an error prevented the write
operation from occurring.string - the string whose bytes will be writtenIOExceptionpublic final int writeBytes(java.lang.StringBuffer sb)
throws IOException
sb - the StringBuffer to get the bytes fromIOExceptionpublic int write(int b)
throws IOException
b - the byte to write (only least significant byte is written)IOExceptionpublic int skipBytes(int n)
throws IOException
n - the number of bytes to be skipped.IOException - if the stream does not support skip, or if some other I/O error occurs.@Deprecated public java.io.InputStream wrapInputStream()
asInputStream() insteadpublic java.io.InputStream asInputStream()
public java.io.OutputStream asOutputStream()
@Deprecated public static Stream wrapInputStreamToStream(java.io.InputStream inputStream)
asStream(InputStream) insteadpublic static Stream asStream(java.io.InputStream inputStream)
public static Stream asStream(java.io.OutputStream outputStream)
public abstract void close()
throws IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableIOException - If an I/O error occurs.