edu.mit.jverbnet.util
Class ByteBufferInputStream
java.lang.Object
java.io.InputStream
edu.mit.jverbnet.util.ByteBufferInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ByteBufferInputStream
- extends java.io.InputStream
Adapts a ByteBuffer to an InputStream.
- Since:
- JVerbnet 1.0.0
- Version:
- 1.2.0
- Author:
- Mark A. Finlayson
|
Field Summary |
protected java.nio.ByteBuffer |
buffer
|
protected int |
mark
|
protected java.io.RandomAccessFile |
raFile
|
|
Constructor Summary |
ByteBufferInputStream(java.nio.ByteBuffer buffer)
Creates a new input stream that wraps the specified byte buffer. |
ByteBufferInputStream(java.io.File file)
Creates a new input stream that wraps the a byte buffer attached to the specified file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buffer
protected java.nio.ByteBuffer buffer
raFile
protected java.io.RandomAccessFile raFile
mark
protected int mark
ByteBufferInputStream
public ByteBufferInputStream(java.nio.ByteBuffer buffer)
- Creates a new input stream that wraps the specified byte buffer.
- Parameters:
buffer - the byte buffer to be wrapped; may not be null
- Throws:
java.lang.NullPointerException - if the specified buffer is null- Since:
- JVerbnet 1.0.0
ByteBufferInputStream
public ByteBufferInputStream(java.io.File file)
throws java.io.IOException
- Creates a new input stream that wraps the a byte buffer attached to the specified file.
- Parameters:
file - the file on which the stream should be opened; may not be null
- Throws:
java.lang.NullPointerException - if the specified file is null
java.io.IOException- Since:
- JVerbnet 1.0.0
checkBuffer
protected void checkBuffer()
throws java.io.IOException
- Throws an exception if the stream has been closed
- Throws:
java.io.IOException - if the stream has been closed- Since:
- JVerbnet 1.0.0
read
public int read()
throws java.io.IOException
- Specified by:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip in class java.io.InputStream
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.InputStream
- Throws:
java.io.IOException
mark
public void mark(int readlimit)
- Overrides:
mark in class java.io.InputStream
reset
public void reset()
throws java.io.IOException
- Overrides:
reset in class java.io.InputStream
- Throws:
java.io.IOException
markSupported
public boolean markSupported()
- Overrides:
markSupported in class java.io.InputStream
Copyright © 2012 ${project.organization.name}. All Rights Reserved.