Minor clean-up and fixing some typos.

This commit is contained in:
Harald Kuhr 2010-06-07 09:56:45 +02:00
parent b6ee5ce450
commit 724d893ea6
2 changed files with 6 additions and 3 deletions

View File

@ -41,8 +41,9 @@ import java.io.ByteArrayInputStream;
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a> * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java#2 $ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java#2 $
*/ */
// TODO: Performance test of a stream impl that uses list of fixed size blocks, rather than contiguous block
public final class FastByteArrayOutputStream extends ByteArrayOutputStream { public final class FastByteArrayOutputStream extends ByteArrayOutputStream {
/** Max grow size (unless if writing more than this ammount of bytes) */ /** Max grow size (unless if writing more than this amount of bytes) */
protected int mMaxGrowSize = 1024 * 1024; // 1 MB protected int mMaxGrowSize = 1024 * 1024; // 1 MB
/** /**
@ -121,7 +122,7 @@ public final class FastByteArrayOutputStream extends ByteArrayOutputStream {
* <p/> * <p/>
* Note that care needs to be taken to avoid writes to * Note that care needs to be taken to avoid writes to
* this output stream after the input stream is created. * this output stream after the input stream is created.
* Failing to do so, may result in unpredictable behviour. * Failing to do so, may result in unpredictable behaviour.
* *
* @return a new {@code ByteArrayInputStream}, reading from this stream's buffer. * @return a new {@code ByteArrayInputStream}, reading from this stream's buffer.
*/ */

View File

@ -1029,6 +1029,7 @@ public final class FileUtil {
* @return a human readable string representation * @return a human readable string representation
*/ */
public static String toHumanReadableSize(final long pSizeInBytes) { public static String toHumanReadableSize(final long pSizeInBytes) {
// TODO: Rewrite to use String.format?
if (pSizeInBytes < 1024L) { if (pSizeInBytes < 1024L) {
return pSizeInBytes + " Bytes"; return pSizeInBytes + " Bytes";
} }
@ -1053,7 +1054,7 @@ public final class FileUtil {
private static ThreadLocal<NumberFormat> sNumberFormat = new ThreadLocal<NumberFormat>() { private static ThreadLocal<NumberFormat> sNumberFormat = new ThreadLocal<NumberFormat>() {
protected NumberFormat initialValue() { protected NumberFormat initialValue() {
NumberFormat format = NumberFormat.getNumberInstance(); NumberFormat format = NumberFormat.getNumberInstance();
// TODO: Consider making this locale/platfor specific, OR a method parameter... // TODO: Consider making this locale/platform specific, OR a method parameter...
// format.setMaximumFractionDigits(2); // format.setMaximumFractionDigits(2);
format.setMaximumFractionDigits(0); format.setMaximumFractionDigits(0);
return format; return format;
@ -1075,6 +1076,7 @@ public final class FileUtil {
* *
* @see com.twelvemonkeys.util.Visitor * @see com.twelvemonkeys.util.Visitor
*/ */
@SuppressWarnings({"ResultOfMethodCallIgnored"})
public static void visitFiles(final File pDirectory, final FileFilter pFilter, final Visitor<File> pVisitor) { public static void visitFiles(final File pDirectory, final FileFilter pFilter, final Visitor<File> pVisitor) {
Validate.notNull(pDirectory, "directory"); Validate.notNull(pDirectory, "directory");
Validate.notNull(pVisitor, "visitor"); Validate.notNull(pVisitor, "visitor");