|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSystem.IO.Stream
public abstract class Stream
Provides a generic view of a sequence of bytes.
Field Summary | |
---|---|
static System.IO.NullStream |
Null
|
Constructor Summary | |
---|---|
protected |
Stream()
Initializes a new instance of the System.IO.Stream class. |
Method Summary | |
---|---|
IAsyncResult |
BeginRead(byte[] buffer,
int offset,
int count,
AsyncCallback callback,
java.lang.Object state)
Begins an asynchronous read operation. |
IAsyncResult |
BeginWrite(byte[] buffer,
int offset,
int count,
AsyncCallback callback,
java.lang.Object state)
Begins an asynchronous write operation. |
abstract boolean |
CanRead()
|
abstract boolean |
CanSeek()
|
boolean |
CanTimeout()
|
abstract boolean |
CanWrite()
|
void |
Close()
|
void |
Dispose()
Releases all resources used by the System.IO.Stream. |
protected void |
Dispose(boolean disposing)
Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed resources. |
int |
EndRead(IAsyncResult asyncResult)
Waits for the pending asynchronous read to complete. |
void |
EndWrite(IAsyncResult asyncResult)
Ends an asynchronous write operation. |
abstract void |
Flush()
When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device. |
abstract long |
getPosition()
|
abstract long |
Length()
|
abstract int |
Read(byte[] buffer,
int offset,
int count)
When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. |
int |
ReadByte()
Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream. |
abstract long |
Seek(long offset,
SeekOrigin origin)
When overridden in a derived class, sets the position within the current stream. |
abstract void |
SetLength(long value)
When overridden in a derived class, sets the length of the current stream. |
abstract void |
setPosition(long value)
|
abstract void |
Write(byte[] buffer,
int offset,
int count)
When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. |
void |
WriteByte(byte value)
Writes a byte to the current position in the stream and advances the position within the stream by one byte. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final System.IO.NullStream Null
Constructor Detail |
---|
protected Stream()
Method Detail |
---|
public abstract boolean CanRead()
public abstract boolean CanSeek()
public boolean CanTimeout()
public abstract boolean CanWrite()
public abstract long Length()
public abstract long getPosition()
public abstract void setPosition(long value)
public IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, java.lang.Object state)
buffer
- offset
- count
- callback
- state
-
public IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, java.lang.Object state)
buffer
- The buffer to write data from.offset
- The byte offset in buffer from which to begin writing.count
- The maximum number of bytes to write.callback
- An optional asynchronous callback, to be called when the write is complete.state
- A user-provided object that distinguishes this particular asynchronous write request from other requests.
IOException
- Attempted an asynchronous write past the end of the stream, or a disk error occurs.
ArgumentException
- One or more of the arguments is invalid.
ObjectDisposedException
- Methods were called after the stream was closed.
NotSupportedException
- The current Stream implementation does not support the write operation.public void Close()
public void Dispose()
Dispose
in interface IDisposable
protected void Dispose(boolean disposing)
disposing
- true to release both managed and unmanaged resources; false to release only unmanaged resources.public int EndRead(IAsyncResult asyncResult)
asyncResult
- The reference to the pending asynchronous request to finish.
public void EndWrite(IAsyncResult asyncResult)
asyncResult
- The reference to the pending asynchronous request to finish.
ArgumentNullException
- asyncResult is null.
ArgumentException
- asyncResult did not originate from a System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object) method on the current stream.
IOException
- The stream is closed or an internal error has occurred.public abstract void Flush()
IOException
- An I/O error occurs.public abstract int Read(byte[] buffer, int offset, int count)
buffer
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.offset
- The zero-based byte offset in buffer at which to begin storing the data read from the current stream.count
- The maximum number of bytes to be read from the current stream.
ArgumentException
- The sum of offset and count is larger than the buffer length.
ArgumentNullException
- buffer is null.
ArgumentOutOfRangeException
- offset or count is negative.
IOException
- An I/O error occurs.
NotSupportedException
- The stream does not support reading.
ObjectDisposedException
- Methods were called after the stream was closed.public int ReadByte()
NotSupportedException
- The stream does not support reading.
ObjectDisposedException
- Methods were called after the stream was closed.public abstract long Seek(long offset, SeekOrigin origin)
offset
- A byte offset relative to the origin parameter.origin
- A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position.
IOException
- An I/O error occurs.
NotSupportedException
- The stream does not support seeking, such as if the stream is constructed from a pipe or console output.
ObjectDisposedException
- Methods were called after the stream was closed.public abstract void SetLength(long value)
value
- The desired length of the current stream in bytes.
IOException
- An I/O error occurs.
NotSupportedException
- The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output.
ObjectDisposedException
- Methods were called after the stream was closed.public abstract void Write(byte[] buffer, int offset, int count)
buffer
- An array of bytes. This method copies count bytes from buffer to the current stream.offset
- The zero-based byte offset in buffer at which to begin copying bytes to the current stream.count
- The number of bytes to be written to the current stream.public void WriteByte(byte value)
value
- The byte to write to the stream.
IOException
- An I/O error occurs.
NotSupportedException
- The stream does not support writing, or the stream is already closed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |