X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Futil%2FInputStreamToByteArray.java;fp=src%2Forg%2Fibex%2Futil%2FInputStreamToByteArray.java;h=0000000000000000000000000000000000000000;hb=ac84b5a03467c0853c7275105712ece6c71be1f1;hp=7e19644a733bd4baeada1ac7078f499e8b1f2e1f;hpb=3f8aa5300e178e8975b0edc896a5a9d303e7bdf3;p=org.ibex.core.git diff --git a/src/org/ibex/util/InputStreamToByteArray.java b/src/org/ibex/util/InputStreamToByteArray.java deleted file mode 100644 index 7e19644..0000000 --- a/src/org/ibex/util/InputStreamToByteArray.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2003 Adam Megacz all rights reserved. -// -// You may modify, copy, and redistribute this code under the terms of -// the GNU Library Public License version 2.1, with the exception of -// the portion of clause 6a after the semicolon (aka the "obnoxious -// relink clause") - -package org.ibex.util; -import java.io.*; - -public class InputStreamToByteArray { - - /** scratch space for isToByteArray() */ - private static byte[] workspace = new byte[16 * 1024]; - - /** Trivial method to completely read an InputStream */ - public static synchronized byte[] convert(InputStream is) throws IOException { - int pos = 0; - while (true) { - int numread = is.read(workspace, pos, workspace.length - pos); - if (numread == -1) break; - else if (pos + numread < workspace.length) pos += numread; - else { - pos += numread; - byte[] temp = new byte[workspace.length * 2]; - System.arraycopy(workspace, 0, temp, 0, workspace.length); - workspace = temp; - } - } - byte[] ret = new byte[pos]; - System.arraycopy(workspace, 0, ret, 0, pos); - return ret; - } - -}