Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.templatemethod
Class ZipSequence.ReadOnlyInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by dk.rode.thesis.templatemethod.ZipSequence.ReadOnlyInputStream
All Implemented Interfaces:
Closeable
Enclosing class:
ZipSequence

 class ZipSequence.ReadOnlyInputStream
extends InputStream

A read-only input stream is a protection proxy (decorator) that ensures that a given input stream cannot be closed or reset by an external context.

Implementation notes:
This is an application of the Proxy pattern.

Author:
Gunni Rode / rode.dk

Constructor Summary
ZipSequence.ReadOnlyInputStream()
          No-arg constructor.
 
Method Summary
 int available()
           
 void close()
          All calls are ignored.
(package private)  ZipSequence getSequence()
          Return the zip sequence this stream is associated with.
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
          All calls are ignored.
 long skip(long n)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZipSequence.ReadOnlyInputStream

ZipSequence.ReadOnlyInputStream()
No-arg constructor.

Method Detail

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
All calls are ignored.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream

getSequence

ZipSequence getSequence()
Return the zip sequence this stream is associated with.

Returns:
The sequence; never null.

mark

public void mark(int readlimit)
Overrides:
mark in class InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

reset

public void reset()
All calls are ignored.

Overrides:
reset in class InputStream

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.