PenProfile 2.x

com.sun.cldc.io
Class ResourceInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.cldc.io.ResourceInputStream

public class ResourceInputStream
extends InputStream

Input stream class for accessing resource files in classpath.


Field Summary
 Object fileDecoder
           
 
Constructor Summary
ResourceInputStream(Object decoder)
           
ResourceInputStream(String name)
          Construct a resource input stream for accessing objects in the jar file.
 
Method Summary
 int available()
          Gets the number of bytes remaining to be read.
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 void mark(int readlimit)
          Remembers current position in ResourceInputStream so that subsequent call to reset will rewind the stream to the saved position.
 boolean markSupported()
          Indicates that this ResourceInputStream supports mark/reset functionality
 int read()
          Reads the next byte of data from the input stream.
 int read(byte[] b, int off, int len)
          Reads bytes into a byte array.
 void reset()
          Repositions this stream to the position at the time the mark method was last called on this input stream.
 long skip(long n)
          Skips over and discards n bytes of data from this input stream.
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileDecoder

public Object fileDecoder
Constructor Detail

ResourceInputStream

public ResourceInputStream(String name)
                    throws IOException
Construct a resource input stream for accessing objects in the jar file.

Parameters:
name - the name of the resource in classpath to access. The name must not have a leading '/'.
Throws:
IOException - if an I/O error occurs.

ResourceInputStream

public ResourceInputStream(Object decoder)
Method Detail

read

public int read()
         throws IOException
Reads the next byte of data from the input stream.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

available

public int available()
              throws IOException
Gets the number of bytes remaining to be read.

Overrides:
available in class InputStream
Returns:
the number of bytes remaining in the resource.
Throws:
IOException - if an I/O error occurs.

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Reads bytes into a byte array.

Overrides:
read in class InputStream
Parameters:
b - the buffer to read into.
off - offset to start at in the buffer.
len - number of bytes to read.
Returns:
the number of bytes read, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.
See Also:
InputStream.read()

close

public void close()
           throws IOException
Description copied from class: InputStream
Closes this input stream and releases any system resources associated with the stream.

The close method of InputStream does nothing.

Overrides:
close in class InputStream
Throws:
IOException - if an I/O error occurs.

mark

public void mark(int readlimit)
Remembers current position in ResourceInputStream so that subsequent call to reset will rewind the stream to the saved position.

Overrides:
mark in class InputStream
Parameters:
readlimit - affects nothing
See Also:
InputStream.reset()

reset

public void reset()
           throws IOException
Repositions this stream to the position at the time the mark method was last called on this input stream.

Overrides:
reset in class InputStream
Throws:
IOException - if this stream has not been marked
See Also:
InputStream.mark(int)

markSupported

public boolean markSupported()
Indicates that this ResourceInputStream supports mark/reset functionality

Overrides:
markSupported in class InputStream
Returns:
true
See Also:
InputStream.mark(int), InputStream.reset()

skip

public long skip(long n)
          throws IOException
Description copied from class: InputStream
Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n is negative, no bytes are skipped.

The skip method of InputStream creates a byte array and then repeatedly reads into it until n bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.

Overrides:
skip in class InputStream
Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws:
IOException - if an I/O error occurs.

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.