|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--hypercast.HCastInputStream
This is the class used to receive data from other nodes
Constructor Summary | |
HCastInputStream(hypercast.StreamManager sm,
byte[] streamID)
Constructs the BoundedBuffer with a size. |
Method Summary | |
int |
available()
* @return the number of bytes available that can be read without blocking |
void |
blockingWrite(byte[] payload)
Writes a message to the BoundedBuffer |
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
int |
getSoTimeout()
Get the timeout time for a read operation. |
int |
getStreamID()
Deprecated. use getStreamIdentifier |
int |
getStreamIdentifier()
|
boolean |
isAssignedToApplication()
|
boolean |
markSupported()
* @ Tests if this input stream supports the mark and reset methods. |
void |
nonblockingWrite(byte[] payload,
int off,
int len)
Writes a message to the DropHeadMessageBuffer |
int |
read()
Reads a byte from the BoundedBuffer. |
int |
read(byte[] b)
Reads a byte from the BoundedBuffer. |
int |
read(byte[] b,
int off,
int len)
Reads a byte from the BoundedBuffer. |
void |
setAssignedFlag(boolean a)
set the flag indicating if the stream has been assigned to the application |
void |
setSoTimeout(int i)
Set the timeout time for a read operation. |
long |
skip(long n)
Skips over and discards n bytes of data from this input stream. |
Methods inherited from class java.io.InputStream |
mark, reset |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HCastInputStream(hypercast.StreamManager sm, byte[] streamID)
Method Detail |
public int getSoTimeout()
public void setSoTimeout(int i)
public int read() throws java.io.IOException
Algorithm:
1. Waits till the buffer is non-empty
2. Copies first byte in the buffer
3. Increments the Start pointer modulo buffer length
4. Decreases size of the buffer
5. Notifies any other process waiting
6. Returns the copied element
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
Algorithm:
1. Waits till the buffer is non-empty
2. Copies first byte in the buffer
3. Increments the Start pointer modulo buffer length
4. Decreases size of the buffer
5. Notifies any other process waiting
6. Returns the copied element
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void nonblockingWrite(byte[] payload, int off, int len)
Algorithm:
1. checks if buffer is full
2. Places New bytes at the end of the buffer
3. Increase number of bytes
4. Notifies all threads waiting
payload
- byte array to be added into the bufferpublic void blockingWrite(byte[] payload) throws java.lang.InterruptedException
Algorithm:
1. checks if buffer is full
2. Places New packet at the end of the buffer
3. Increase number of elements
4. Notifies all threads waiting
payload
- byte array to be added into the buffer
java.lang.InterruptedException
public void close()
close
in class java.io.InputStream
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public int getStreamID()
public int getStreamIdentifier()
public boolean isAssignedToApplication()
public void setAssignedFlag(boolean a)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |