org.deken.game.utils
Class LoopingByteInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by org.deken.game.utils.LoopingByteInputStream
All Implemented Interfaces:
java.io.Closeable

public class LoopingByteInputStream
extends java.io.ByteArrayInputStream

Title: LoopingByteInputStream

Description: TODO

Copyright: Copyright (c) 2006

Version:
1.0
Author:
Gary Deken

Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
LoopingByteInputStream(byte[] buffer)
          LoopingByteInputStream
 
Method Summary
 void close()
          close
 int read(byte[] buffer, int offset, int length)
          read
 
Methods inherited from class java.io.ByteArrayInputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopingByteInputStream

public LoopingByteInputStream(byte[] buffer)
LoopingByteInputStream

Creates a new LoopingByteInputStream with the specified byte array.

Parameters:
buffer - byte[]
Method Detail

read

public int read(byte[] buffer,
                int offset,
                int length)
read

Reads length bytes from the array. If the end of the array is readed, the reading starts over from the beginning of the array. Returns -1 if the array has been closed.

Overrides:
read in class java.io.ByteArrayInputStream
Parameters:
buffer - byte[]
offset - int
length - int
Returns:
int

close

public void close()
           throws java.io.IOException
close

Closes the stream. Future calls to the read() method will return -1.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.ByteArrayInputStream
Throws:
java.io.IOException