PullSourceStream2InputStreampublic class PullSourceStream2InputStream extends InputStream PullSourceStream2InputStream is an adaptor between a PullSourceStream
and an InputStream. In receives in its constructor a PullSourceStream
and uses that stream in order to implement the InputStream methods |
Fields Summary |
---|
PullSourceStream | pssThe PullSourceStream to be used | byte[] | bufferA byte array of size 1, for the read() method |
Constructors Summary |
---|
public PullSourceStream2InputStream(PullSourceStream pss)Constructor
this.pss = pss;
|
Methods Summary |
---|
public int | available()
// NOT IMPLEMENTED
System.out.println("available was called");
return 0;
| public void | close()
// DO NOTHING (???)
| public boolean | markSupported()
return false;
| public int | read()
if (pss.endOfStream()) {
System.out.println("end of stream");
return -1;
}
pss.read(buffer, 0, 1);
return buffer[0];
| public int | read(byte[] b)
return pss.read(b, 0, b.length);
| public int | read(byte[] b, int off, int len)
return pss.read(b, off, len);
| public long | skip(long n)
byte[] buffer = new byte[(int)n];
int read = read(buffer);
return read;
|
|