|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dguitar.codecs.guitarPro.GPInputStream
This class is the base class to read Guitar Pro files. It is extended by GP3InputStream and GP4InputStream that read respectively files of version 3 and 4.
Field Summary | |
protected java.lang.String |
__fileName
The filename (equals to "" if not available). |
protected java.lang.String |
__version
The file version. |
private CodecFileFilter |
_codecFileFilter
The file filter. |
private java.io.InputStream |
_in
The InputStream from which the data is read. |
private int |
_offset
The offset where we got so far in the file. |
Constructor Summary | |
|
GPInputStream(java.io.File f)
Creates a new GPInputStream using the file f . |
protected |
GPInputStream(GPInputStream gpIn)
Creates a new GPInputStream by cloning an existing GPInputStream. |
|
GPInputStream(java.io.InputStream in)
Creates a new GPInputStream from an existing stream. |
|
GPInputStream(java.lang.String fileName)
Creates a new GPInputStream using the file of name fileName . |
private |
GPInputStream(java.lang.String fileName,
java.io.InputStream in)
Creates a new GPInputStream from an existing stream. |
Method Summary | |
protected void |
assertBytesEqualTo(int n,
int v)
Asserts that n consecutive bytes are equal to a certain value. |
void |
close()
Closes the stream. |
protected void |
dumpBytes(int n)
Reads n bytes and prints them to the screen |
protected void |
dumpInts(int n)
Reads n ints and prints them to the screen |
int |
read()
Reads the next byte of data from the input stream. |
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer array b. |
protected boolean |
readBoolean()
Reads a boolean from the stream. |
protected byte |
readByte()
Reads a byte from the stream. |
protected double |
readDouble()
Reads a double from the stream. |
protected float |
readFloat()
Reads an float from the stream. |
protected int |
readInt()
Reads an LSB integer from the stream. |
protected long |
readLong()
Reads a long integer from the stream. |
java.lang.Object |
readObject()
Read the input stream on to a single object !! |
private GPSong |
readPiece()
Reads a piece from the stream. |
protected java.lang.String |
readStringByte(int expectedLength)
Reads a string from the stream ; its length is given by a byte. |
protected java.lang.String |
readStringByteMaxLengthPlusOne()
Reads a string from the stream ; its maximum length is obtained by substracting 1 to a byte read, while its real length is obtained by reading the next byte. |
protected java.lang.String |
readStringInteger()
Reads a string from the stream ; its length is given by an integer. |
protected java.lang.String |
readStringIntegerPlusOne()
Reads a string from the stream ; its length is obtained by substracting 1 to an integer read. |
protected int |
readUnsignedByte()
Reads an unsigned byte from the stream. |
long |
skip(long n)
Skips over and discards n bytes of data from this input stream. |
boolean |
supportedExtension(java.lang.String extension)
Returns if the extension is supported by this codec |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String __fileName
protected java.lang.String __version
private CodecFileFilter _codecFileFilter
private java.io.InputStream _in
private int _offset
Constructor Detail |
public GPInputStream(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
.
fileName
- the given file's name.
java.io.FileNotFoundException
public GPInputStream(java.io.File f) throws java.io.FileNotFoundException
f
.
f
- the given file.
java.io.FileNotFoundException
public GPInputStream(java.io.InputStream in)
in
- the original stream.private GPInputStream(java.lang.String fileName, java.io.InputStream in)
fileName
- the name of the file the stream has been opened from.in
- the original stream.protected GPInputStream(GPInputStream gpIn)
gpIn
- the original GPInputStream.Method Detail |
public void close() throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
java.io.IOException
public int read(byte[] b) throws java.io.IOException
b
- the buffer into which the data is read.
java.io.IOException
public java.lang.Object readObject() throws java.io.IOException, GPFormatException
CodecInputStream
readObject
in interface CodecInputStream
java.io.IOException
GPFormatException
CodecInputStream.readObject()
public long skip(long n) throws java.io.IOException
n
- the number of bytes to be skipped.
java.io.IOException
public boolean supportedExtension(java.lang.String extension)
Codec
supportedExtension
in interface Codec
extension
- ".GP3" or ".TAB" or something else
Codec.supportedExtension(java.lang.String)
protected void assertBytesEqualTo(int n, int v) throws java.io.IOException
n
- the number of bytes.v
- the value.
java.io.IOException
protected void dumpBytes(int n) throws java.io.IOException
n
- the number of bytes to read
java.io.IOException
protected void dumpInts(int n) throws java.io.IOException
n
- the number of ints to read
java.io.IOException
protected boolean readBoolean() throws java.io.IOException
java.io.IOException
protected byte readByte() throws java.io.IOException
java.io.IOException
protected double readDouble() throws java.io.IOException
java.io.IOException
protected float readFloat() throws java.io.IOException
java.io.IOException
protected int readInt() throws java.io.IOException
java.io.IOException
protected long readLong() throws java.io.IOException
java.io.IOException
protected java.lang.String readStringByte(int expectedLength) throws java.io.IOException
expectedLength
- if superior to 0, gives the maximum length we expect to find.
java.io.IOException
protected java.lang.String readStringInteger() throws java.io.IOException
java.io.IOException
protected java.lang.String readStringIntegerPlusOne() throws java.io.IOException
java.io.IOException
protected java.lang.String readStringByteMaxLengthPlusOne() throws java.io.IOException
java.io.IOException
protected int readUnsignedByte() throws java.io.IOException
java.io.IOException
private GPSong readPiece() throws java.io.IOException, GPFormatException
java.io.IOException
GPFormatException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |