/[classpath]/classpath/gnu/java/net/LineInputStream.java
ViewVC logotype

Diff of /classpath/gnu/java/net/LineInputStream.java

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

revision 1.2.2.3 by gnu_andrew, Tue Aug 2 20:12:11 2005 UTC revision 1.2.2.4 by gnu_andrew, Wed Nov 2 00:43:27 2005 UTC
# Line 1  Line 1 
1  /* LineInputStream.java --  /* LineInputStream.java --
2     Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.     Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package gnu.java.net;  package gnu.java.net;
40    
41    import java.io.BufferedInputStream;
42  import java.io.ByteArrayOutputStream;  import java.io.ByteArrayOutputStream;
43  import java.io.FilterInputStream;  import java.io.FilterInputStream;
44  import java.io.IOException;  import java.io.IOException;
# Line 91  public class LineInputStream Line 92  public class LineInputStream
92      buf = new ByteArrayOutputStream();      buf = new ByteArrayOutputStream();
93      this.encoding = encoding;      this.encoding = encoding;
94      eof = false;      eof = false;
95      blockReads = in.markSupported();      // If it is already buffered, additional buffering gains nothing.
96        blockReads = !(in instanceof BufferedInputStream) && in.markSupported();
97    }    }
98    
99    /**    /**
# Line 109  public class LineInputStream Line 111  public class LineInputStream
111          if (blockReads)          if (blockReads)
112            {            {
113              // Use mark and reset to read chunks of bytes              // Use mark and reset to read chunks of bytes
114              final int MIN_LENGTH = 1024;              final int MAX_LENGTH = 1024;
115              int len, pos;              int len, pos;
116                
117              len = in.available();              len = in.available();
118              len = (len < MIN_LENGTH) ? MIN_LENGTH : len;              if (len == 0 || len > MAX_LENGTH)
119                  len = MAX_LENGTH;
120              byte[] b = new byte[len];              byte[] b = new byte[len];
121              in.mark(len);              in.mark(len);
122              // Read into buffer b              // Read into buffer b

Legend:
Removed from v.1.2.2.3  
changed lines
  Added in v.1.2.2.4

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