Brooklyn

brooklyn.util
[Java] Class ReaderInputStream

java.lang.Object
  java.io.InputStream
      brooklyn.util.ReaderInputStream

public class ReaderInputStream
extends java.io.InputStream

Constructor Summary
ReaderInputStream(java.io.Reader reader)

Construct a ReaderInputStream for the specified Reader.

ReaderInputStream(java.io.Reader reader, java.lang.String encoding)

Construct a ReaderInputStream for the specified Reader, with the specified encoding.

 
Method Summary
int available()

@return the current number of bytes ready for reading

void close()

Closes the Stringreader.

void mark(int limit)

Marks the read limit of the StringReader.

boolean markSupported()

@return false - mark is not supported

int read()

Reads from the Reader, returning the same value.

int read(byte[] b, int off, int len)

Reads from the Reader into a byte array

void reset()

Resets the StringReader.

 
Methods inherited from class java.io.InputStream
java.io.InputStream#close(), java.io.InputStream#mark(int), java.io.InputStream#reset(), java.io.InputStream#read([B, int, int), java.io.InputStream#read([B), java.io.InputStream#read(), java.io.InputStream#skip(long), java.io.InputStream#available(), java.io.InputStream#markSupported(), java.io.InputStream#wait(), java.io.InputStream#wait(long), java.io.InputStream#wait(long, int), java.io.InputStream#equals(java.lang.Object), java.io.InputStream#toString(), java.io.InputStream#hashCode(), java.io.InputStream#getClass(), java.io.InputStream#notify(), java.io.InputStream#notifyAll()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

ReaderInputStream

public ReaderInputStream(java.io.Reader reader)
Construct a ReaderInputStream for the specified Reader.
Parameters:
reader - Reader. Must not be null.


ReaderInputStream

public ReaderInputStream(java.io.Reader reader, java.lang.String encoding)
Construct a ReaderInputStream for the specified Reader, with the specified encoding.
Parameters:
reader - non-null Reader.
encoding - non-null String encoding.


 
Method Detail

available

public int available()
Throws:
IOException if an error occurs
Returns:
the current number of bytes ready for reading


close

public void close()
Closes the Stringreader.
Throws:
IOException if the original StringReader fails to be closed


mark

public void mark(int limit)
Marks the read limit of the StringReader.
Parameters:
limit - the maximum limit of bytes that can be read before the mark position becomes invalid


markSupported

public boolean markSupported()
Returns:
false - mark is not supported


read

public int read()
Reads from the Reader, returning the same value.
Throws:
IOException if the original Reader fails to be read
Returns:
the value of the next character in the Reader.


read

public int read(byte[] b, int off, int len)
Reads from the Reader into a byte array
Throws:
IOException if an error occurs
Parameters:
b - the byte array to read into
off - the offset in the byte array
len - the length in the byte array to fill
Returns:
the actual number read into the byte array, -1 at the end of the stream


reset

public void reset()
Resets the StringReader.
Throws:
IOException if the StringReader fails to be reset


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.