You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by je...@apache.org on 2011/02/12 20:17:53 UTC
svn commit: r1070135 -
/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
Author: jeremias
Date: Sat Feb 12 19:17:53 2011
New Revision: 1070135
URL: http://svn.apache.org/viewvc?rev=1070135&view=rev
Log:
Fixed some typos.
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java?rev=1070135&r1=1070134&r2=1070135&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java Sat Feb 12 19:17:53 2011
@@ -24,10 +24,10 @@ import java.io.StreamCorruptedException;
/**
* This Image tag registry entry is built around the notion of magic
- * numbers. These are strings of bytes that are at a well known
+ * numbers. These are strings of bytes that are at a well known
* location in the input stream (often the start).
*
- * This base class can handle the compatiblity check based on a list
+ * This base class can handle the compatibility check based on a list
* of Magic Numbers that correspond to your format (Some formats have
* multiple magic numbers associated with them).
*
@@ -56,13 +56,13 @@ public abstract class MagicNumberRegistr
*/
public MagicNumber(int offset, byte[]magicNumber) {
this.offset = offset;
- this.magicNumber = (byte[])magicNumber.clone();
+ this.magicNumber = magicNumber.clone();
buffer = new byte[magicNumber.length];
}
/**
* Returns the maximum number of bytes that will be read for
- * this magic number compairison.
+ * this magic number comparison.
*/
int getReadlimit() {
return offset+magicNumber.length;
@@ -79,20 +79,25 @@ public abstract class MagicNumberRegistr
// Skip to the offset location.
while (idx < offset) {
int rn = (int)is.skip(offset-idx);
- if (rn == -1) return false;
+ if (rn == -1) {
+ return false;
+ }
idx += rn;
}
idx = 0;
while (idx < buffer.length) {
int rn = is.read(buffer, idx, buffer.length-idx);
- if (rn == -1) return false;
+ if (rn == -1) {
+ return false;
+ }
idx += rn;
}
for (int i=0; i<magicNumber.length; i++) {
- if (magicNumber[i] != buffer[i])
+ if (magicNumber[i] != buffer[i]) {
return false;
+ }
}
} catch (IOException ioe) {
return false;
@@ -100,7 +105,7 @@ public abstract class MagicNumberRegistr
try {
// Make sure we always put back what we have read.
// If this throws an IOException then the current
- // stream should be closed an reopend by the registry.
+ // stream should be closed an reopened by the registry.
is.reset();
} catch (IOException ioe) {
throw new StreamCorruptedException(ioe.getMessage());
@@ -269,13 +274,15 @@ public abstract class MagicNumberRegistr
}
/**
- * Returns the maximume read ahead needed for all magic numbers.
+ * Returns the maximum read ahead needed for all magic numbers.
*/
public int getReadlimit() {
int maxbuf = 0;
for (int i=0; i<magicNumbers.length; i++) {
int req = magicNumbers[i].getReadlimit();
- if (req > maxbuf) maxbuf = req;
+ if (req > maxbuf) {
+ maxbuf = req;
+ }
}
return maxbuf;
}
@@ -287,8 +294,9 @@ public abstract class MagicNumberRegistr
public boolean isCompatibleStream(InputStream is)
throws StreamCorruptedException {
for (int i=0; i<magicNumbers.length; i++) {
- if (magicNumbers[i].isMatch(is))
+ if (magicNumbers[i].isMatch(is)) {
return true;
+ }
}
return false;