This class represents an ASCII85 stream.
Method from org.apache.pdfbox.io.ASCII85InputStream Detail: |
public int available() {
return 0;
}
|
public void close() throws IOException {
ascii = null;
eof = true;
b = null;
super.close();
}
This will close the underlying stream and release any resources. |
public void mark(int readlimit) {
}
|
public boolean markSupported() {
return false;
}
non supported interface methods. |
public final int read() throws IOException {
if( index >= n )
{
if(eof)
{
return -1;
}
index = 0;
int k;
byte z;
do
{
int zz=(byte)in.read();
if(zz==-1)
{
eof=true;
return -1;
}
z = (byte)zz;
} while( z=='\n' || z=='\r' || z==' ');
if (z == '~' || z=='x')
{
eof=true;
ascii=b=null;
n = 0;
return -1;
}
else if (z == 'z')
{
b[0]=b[1]=b[2]=b[3]=0;
n = 4;
}
else
{
ascii[0]=z; // may be EOF here....
for (k=1;k< 5;++k)
{
do
{
int zz=(byte)in.read();
if(zz==-1)
{
eof=true;
return -1;
}
z=(byte)zz;
} while ( z=='\n' || z=='\r' || z==' ' );
ascii[k]=z;
if (z == '~' || z=='x')
{
break;
}
}
n = k - 1;
if ( n==0 )
{
eof = true;
ascii = null;
b = null;
return -1;
}
if ( k < 5 )
{
for (++k; k < 5; ++k )
{
ascii[k] = 0x21;
}
eof=true;
}
// decode stream
long t=0;
for ( k=0; k< 5; ++k)
{
z=(byte)(ascii[k] - 0x21);
if (z < 0 || z > 93)
{
n = 0;
eof = true;
ascii = null;
b = null;
throw new IOException("Invalid data in Ascii85 stream");
}
t = (t * 85L) + z;
}
for ( k = 3; k >=0; --k)
{
b[k] = (byte)(t & 0xFFL);
t > > >=8;
}
}
}
return b[index++] & 0xFF;
}
This will read the next byte from the stream. |
public final int read(byte[] data,
int offset,
int len) throws IOException {
if(eof && index >=n)
{
return -1;
}
for(int i=0;i< len;i++)
{
if(index< n)
{
data[i+offset]=b[index++];
}
else
{
int t = read();
if ( t == -1 )
{
return i;
}
data[i+offset]=(byte)t;
}
}
return len;
}
This will read a chunk of data. |
public void reset() throws IOException {
throw new IOException("Reset is not supported");
}
|
public long skip(long nValue) {
return 0;
}
|