/[classpath]/classpath/java/net/URLClassLoader.java
ViewVC logotype

Diff of /classpath/java/net/URLClassLoader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mark, Thu Jul 17 16:47:02 2003 UTC revision 1.18 by jfrijters, Tue Aug 12 10:16:59 2003 UTC
# Line 774  public class URLClassLoader extends Secu Line 774  public class URLClassLoader extends Secu
774        {        {
775          byte [] data;          byte [] data;
776          InputStream in = resource.getInputStream();          InputStream in = resource.getInputStream();
777          int length = resource.getLength();          try
         if (length != -1)  
778            {            {
779              // We know the length of the data.              int length = resource.getLength();
780              // Just try to read it in all at once              if (length != -1)
781              data = new byte[length];              {
782              int pos = 0;                  // We know the length of the data.
783              while(length - pos > 0)                  // Just try to read it in all at once
784                {                  data = new byte[length];
785                  int len = in.read(data, pos, length - pos);                  int pos = 0;
786                  if (len == -1)                  while(length - pos > 0)
787                    throw new EOFException("Not enough data reading from: "                  {
788                                           + in);                      int len = in.read(data, pos, length - pos);
789                  pos += len;                      if (len == -1)
790                }                      throw new EOFException("Not enough data reading from: "
791            }                                              + in);
792          else                      pos += len;
793            {                  }
794              // We don't know the data length.              }
795              // Have to read it in chunks.              else
796              ByteArrayOutputStream out = new ByteArrayOutputStream(4096);              {
797              byte b[] = new byte[4096];                  // We don't know the data length.
798              int l = 0;                  // Have to read it in chunks.
799              while (l != -1)                  ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
800                {                  byte b[] = new byte[4096];
801                  l = in.read(b);                  int l = 0;
802                  if (l != -1)                  while (l != -1)
803                    out.write(b, 0, l);                  {
804                }                      l = in.read(b);
805              data = out.toByteArray();                      if (l != -1)
806                        out.write(b, 0, l);
807                    }
808                    data = out.toByteArray();
809                }
810            }            }
811            finally
812              {
813                in.close();
814              }
815          final byte[] classData = data;          final byte[] classData = data;
816    
817          // Now get the CodeSource          // Now get the CodeSource

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26