Lines 70-87
Link Here
|
70 |
protected Log log = LogFactory.getLog(PFMFile.class); |
70 |
protected Log log = LogFactory.getLog(PFMFile.class); |
71 |
|
71 |
|
72 |
/** |
72 |
/** |
|
|
73 |
* Parses a PFM file. |
74 |
* It is the same as load(inStream, 0); |
75 |
* |
76 |
* @param inStream The stream from which to read the PFM file. |
77 |
* @throws IOException In case of an I/O problem |
78 |
*/ |
79 |
public void load(InputStream inStream) throws IOException { |
80 |
load(inStream, 0); |
81 |
} |
82 |
|
83 |
/** |
73 |
* Parses a PFM file |
84 |
* Parses a PFM file |
74 |
* |
85 |
* |
75 |
* @param inStream The stream from which to read the PFM file. |
86 |
* @param inStream The stream from which to read the PFM file. |
|
|
87 |
* @param bufferSize If inStream doesn't support marks and it is going to be buffered, the size the bufferd stream must have. |
88 |
* Will be ignored if inStream supports marks. Should equal the full size of inStream. |
76 |
* @throws IOException In case of an I/O problem |
89 |
* @throws IOException In case of an I/O problem |
77 |
*/ |
90 |
*/ |
78 |
public void load(InputStream inStream) throws IOException { |
91 |
public void load(InputStream inStream, int bufferSize) throws IOException { |
79 |
InputStream bufin = inStream; |
92 |
InputStream bufin = inStream; |
80 |
if (!bufin.markSupported()) { |
93 |
if (!bufin.markSupported()) { |
81 |
bufin = new BufferedInputStream(bufin); |
94 |
if (bufferSize > 0) |
|
|
95 |
bufin = new BufferedInputStream(bufin, bufferSize); |
96 |
else |
97 |
bufin = new BufferedInputStream(bufin); |
98 |
|
82 |
} |
99 |
} |
83 |
PFMInputStream in = new PFMInputStream(bufin); |
100 |
PFMInputStream in = new PFMInputStream(bufin); |
84 |
bufin.mark(16); |
101 |
// increased buff.mark() four times to avoid errors when reading fontnames larger than 16 characters. |
|
|
102 |
// bufin.mark(16); |
103 |
bufin.mark(64); |
85 |
short sh1 = in.readByte(); |
104 |
short sh1 = in.readByte(); |
86 |
short sh2 = in.readByte(); |
105 |
short sh2 = in.readByte(); |
87 |
if (sh1 == 128 && sh2 == 1) { |
106 |
if (sh1 == 128 && sh2 == 1) { |