下面列出了java.nio.BufferUnderflowException#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
static TagMapImpl deserializeBinary(byte[] bytes) throws TagContextDeserializationException {
try {
if (bytes.length == 0) {
// Does not allow empty byte array.
throw new TagContextDeserializationException("Input byte[] can not be empty.");
}
ByteBuffer buffer = ByteBuffer.wrap(bytes).asReadOnlyBuffer();
int versionId = buffer.get();
if (versionId > VERSION_ID || versionId < 0) {
throw new TagContextDeserializationException(
"Wrong Version ID: " + versionId + ". Currently supports version up to: " + VERSION_ID);
}
return new TagMapImpl(parseTags(buffer));
} catch (BufferUnderflowException exn) {
throw new TagContextDeserializationException(exn.toString()); // byte array format error.
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}
private void verifyPFB(ByteBuffer bb) throws FontFormatException {
int pos = 0;
while (true) {
try {
int segType = bb.getShort(pos) & 0xffff;
if (segType == 0x8001 || segType == 0x8002) {
bb.order(ByteOrder.LITTLE_ENDIAN);
int segLen = bb.getInt(pos+2);
bb.order(ByteOrder.BIG_ENDIAN);
if (segLen <= 0) {
throw new FontFormatException("bad segment length");
}
pos += segLen+6;
} else if (segType == 0x8003) {
return;
} else {
throw new FontFormatException("bad pfb file");
}
} catch (BufferUnderflowException bue) {
throw new FontFormatException(bue.toString());
} catch (Exception e) {
throw new FontFormatException(e.toString());
}
}
}