org.mmbase.util
Class SerializableInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.mmbase.util.SerializableInputStream
All Implemented Interfaces:
Closeable, Serializable
Direct Known Subclasses:
Casting.StringSerializableInputStream

public class SerializableInputStream
extends InputStream
implements Serializable

Sometimes you need an InputStream to be Serializable. This wraps another InputStream, or some other representation of a 'binary'.

Since:
MMBase-1.9
Version:
$Id: SerializableInputStream.java 41244 2010-03-02 17:07:36Z michiel $
Author:
Michiel Meeuwissen
See Also:
Serialized Form
To Do:
IllegalStateException or so, if the inputstreas is used (already).

Constructor Summary
SerializableInputStream(byte[] array)
           
SerializableInputStream(File tempFile)
           
SerializableInputStream(FileItem fi)
           
SerializableInputStream(File tempFile, String name)
           
SerializableInputStream(InputStream wrapped, long s)
           
SerializableInputStream(SerializableInputStream is)
           
 
Method Summary
protected  void _readObject(ObjectInputStream oin)
           
protected  void _writeObject(ObjectOutputStream out)
           
 void close()
           
 boolean equals(Object o)
           
 void finalize()
           
 byte[] get()
           
 String getContentType()
           
(package private)  File getFile()
           
 String getFileName()
           
 String getName()
           
 long getSize()
           
 int hashCode()
           
protected static boolean inputStreamEquals(SerializableInputStream in1, SerializableInputStream in2)
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 void moveTo(File f)
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 void setContentType(MimeType ct)
           
 long skip(long n)
           
static byte[] toByteArray(InputStream stream)
           
 String toString()
           
 
Methods inherited from class java.io.InputStream
available
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerializableInputStream

public SerializableInputStream(InputStream wrapped,
                               long s)

SerializableInputStream

public SerializableInputStream(File tempFile,
                               String name)
                        throws IOException
Throws:
IOException
Since:
MMBase-1.9.2

SerializableInputStream

public SerializableInputStream(File tempFile)
                        throws IOException
Throws:
IOException
Since:
MMBase-1.9.2

SerializableInputStream

public SerializableInputStream(byte[] array)

SerializableInputStream

public SerializableInputStream(FileItem fi)
                        throws IOException
Throws:
IOException

SerializableInputStream

SerializableInputStream(SerializableInputStream is)
                  throws IOException
Throws:
IOException
Method Detail

toByteArray

public static byte[] toByteArray(InputStream stream)

getSize

public long getSize()

getName

public String getName()

getContentType

public String getContentType()

setContentType

public void setContentType(MimeType ct)
Since:
MMBase-1.9.3

get

public byte[] get()
           throws IOException
Throws:
IOException

moveTo

public void moveTo(File f)

_writeObject

protected void _writeObject(ObjectOutputStream out)
                     throws IOException
Throws:
IOException

_readObject

protected void _readObject(ObjectInputStream oin)
                    throws IOException,
                           ClassNotFoundException
Throws:
IOException
ClassNotFoundException

finalize

public void finalize()
Overrides:
finalize in class Object

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

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

skip

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

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

inputStreamEquals

protected static boolean inputStreamEquals(SerializableInputStream in1,
                                           SerializableInputStream in2)
                                    throws IOException
Throws:
IOException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getFile

File getFile()

getFileName

public String getFileName()
Since:
MMBase-1.9.2


MMBase 2.0-SNAPSHOT - null