Marks the following bytes in the stream as active.
@param len The number of bytes in the active region.
@throws IllegalArgumentException The number of bytes in the active region
is longer than the remainder of the input.
559658
public void
setActive(int len) {
	if (len > array.length - pos) {
		throw new IllegalArgumentException("cannot set active " +
						   "region past end of input");
	}
	end = pos + len;
}
151425
public void write(String s, int off, int len) throws IOException {
        // defect 312981 begin
        //ensureOpen();
    	if (closed) {
    	    throw new IOException("Stream closed");
        }
        // defect 312981 end
        if (bufferSize == 0) {
            initOut();
            out.write(s, off, len);
            return;
        }
        int b = off, t = off + len;
        while (b < t) {
            int d = min(bufferSize - nextChar, t - b);
            s.getChars(b, b + d, cb, nextChar);
            b += d;
            nextChar += d;
            if (nextChar >= bufferSize) 
                if (autoFlush)
                    flushBuffer();
                else
                    bufferOverflow();
        }
    }
220579
public void setBuffer (byte[] bytes, int offset, int count) {
		if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
		buffer = bytes;
		position = offset;
		limit = offset + count;
		capacity = bytes.length;
		total = 0;
		inputStream = null;
	}
793155
static byte[] asByteArray(final InputStream in) throws IllegalArgumentException {
        // Precondition check
        if (in == null) {
            throw new IllegalArgumentException("stream must be specified");
        }

        // Get content as an array of bytes
        final ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
        final int len = 4096;
        final byte[] buffer = new byte[len];
        int read = 0;
        try {
            while (((read = in.read(buffer)) != -1)) {
                out.write(buffer, 0, read);
            }
        } catch (final IOException ioe) {
            throw new RuntimeException("Error in obtainting bytes from " + in, ioe);
        } finally {
            try {
                in.close();
            } catch (final IOException ignore) {
                if (log.isLoggable(Level.FINER)) {
                    log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
                }
            }
            // We don't need to close the outstream, it's a byte array out
        }

        // Represent as byte array
        final byte[] content = out.toByteArray();

        // Return
        return content;
    }
1258336
public void writeLength(long length) {
    if (length < 251) {
      buf[position++] = (byte) length;
    } else if (length < 65536) {
      buf[position++] = (byte) 0xfc;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
    } else if (length < 16777216) {
      buf[position++] = (byte) 0xfd;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
      buf[position++] = (byte) (length >>> 16);
    } else {
      buf[position++] = (byte) 0xfe;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
      buf[position++] = (byte) (length >>> 16);
      buf[position++] = (byte) (length >>> 24);
      buf[position++] = (byte) (length >>> 32);
      buf[position++] = (byte) (length >>> 40);
      buf[position++] = (byte) (length >>> 48);
      buf[position++] = (byte) (length >>> 54);
    }
  }
186959
@Override
    public void write(byte[] b, int off, int len) throws IOException
    {
        int wbytes = len;
        int offset = off;
        
        while( wbytes > 0 )
        {
            if ( buf.position() >= buf.capacity() )
            {
                flush();
            }
            
            int length = Math.min( wbytes, buf.limit() - buf.position() );
            
            buf.put(b, offset, length);
            
            offset += length;
            wbytes -= length;
        }
    }
268318
public void
restoreActive(int pos) {
	if (pos > byteBuffer.capacity()) {
		throw new IllegalArgumentException("cannot set active " +
						   "region past end of input");
	}
	byteBuffer.limit(byteBuffer.position());
}
283726
public void print(long l) throws IOException
  {
    String value = Long.toString(l);
    this.output.write(value.getBytes(), 0, value.length());
  }
842085
public void write(byte[] b, int off, int len) throws IOException
	{
		//PK89810, If WCCustomProperties.FINISH_RESPONSE_ON_CLOSE is set and stream is already obtained and closed. 
		// User will not be allowed to write more data if the above case is met, outputstreamClosed will be true and default is false.
		if (!(WCCustomProperties.FINISH_RESPONSE_ON_CLOSE) || !outputstreamClosed ) //PK89810
		{
		if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
			logger.logp(Level.FINE, CLASS_NAME,"write", "write len --> "+len);
        }
		if (len < 0)
		{
			logger.logp(Level.SEVERE, CLASS_NAME,"write", "Illegal.Argument.Trying.to.write.chars");
			throw new IllegalArgumentException();
		}
		if (!_hasWritten && obs != null)
		{
			_hasWritten = true;
			if (obsList!=null){
				for (int i=0;i<obsList.size();i++){
					obsList.get(i).alertFirstWrite();
				}
			}
			else {
			obs.alertFirstWrite();
		}
		}
		if (limit > -1)
		{
			if (total + len > limit)
			{
				len = limit - total;
				except = new WriteBeyondContentLengthException();
			}
		}
		if (len >= buf.length)
		{
			response.setFlushMode(false);
			flushBytes();
			total += len;
			writeOut(b, off, len);
			response.setFlushMode(true);
			check();
			return;
		}
		int avail = buf.length - count;
		if (len > avail)
		{
			response.setFlushMode(false);
			flushBytes();
			response.setFlushMode(true);
		}
		System.arraycopy(b, off, buf, count, len);
		count += len;
		total += len;
		check();
	}
		else
		{//PK89810 start
			if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
				logger.logp(Level.FINE, CLASS_NAME,"write", "write bytes not allowed, outputstreamClosed value --> " + outputstreamClosed);			
		}//PK89810 End
	}
1359728
public void setLen(int len) {
    	if (len > data.length) {
    		len = data.length;
    	}
    	this.len = len;
    }
1047530
@Override
    public void setContentLengthLong (long len) {
        String methodName = "setContentLengthLong";
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { 
            logger.entering(CLASS_NAME, methodName, "length --> " + String.valueOf(len) + " ["+this+"]");
        }

        // check the include flag
        WebAppDispatcherContext dispatchContext = (WebAppDispatcherContext) getRequest().getWebAppDispatcherContext();
        if (dispatchContext.isInclude() == true) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
                logger.logp(Level.FINE, CLASS_NAME, methodName, nls.getString("Illegal.from.included.servlet", "Illegal from included servlet"), methodName + " length --> " + String.valueOf(len));  //311717
            }
        }
        else
        {
            if (_response!=null) {
                if (!_response.isCommitted()) {
                    ((IResponse31)_response).setContentLengthLong(len);
                }
            }
            _contentLength = len;
            
            _bufferedWriter.setLimitLong(_contentLength);
            //still want to try to set the header even if the response is committed to throw the warning
            setHeader(HEADER_CONTENT_LENGTH, Long.toString(_contentLength)); // TODO SERVLET 3.1 - Need "long" implementation??
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.exiting(CLASS_NAME, methodName);
        }
       
    }
905589
static int getLength(int lenByte, InputStream in) throws IOException {
        int value, tmp;

        tmp = lenByte;
        if ((tmp & 0x080) == 0x00) { // short form, 1 byte datum
            value = tmp;
        } else {                     // long form or indefinite
            tmp &= 0x07f;

            /*
             * NOTE:  tmp == 0 indicates indefinite length encoded data.
             * tmp > 4 indicates more than 4Gb of data.
             */
            if (tmp == 0)
                return -1;
            if (tmp < 0 || tmp > 4)
                throw new IOException("DerInputStream.getLength(): lengthTag="
                    + tmp + ", "
                    + ((tmp < 0) ? "incorrect DER encoding." : "too big."));

            for (value = 0; tmp > 0; tmp --) {
                value <<= 8;
                value += 0x0ff & in.read();
            }
            if (value < 0) {
                throw new IOException("DerInputStream.getLength(): "
                        + "Invalid length bytes");
            }
        }
        return value;
    }
836840
public void write(byte b[], int off, int len) {
    expandIfNecessary(count + len);
    System.arraycopy(b, off, bytes, count, len);
    count += len;
  }
763053
private static long bytesToLongBE(InputStream input, int n)
            throws IOException
    {
        long out = 0;
        long val;
        while (n > 0) {
            n--;
            // store it in a long and then shift else integer overflow will occur
            val = input.read();
            out |= (val << (n * 8));
        }
        return out;
    }
1143283
@Override
    public long skip(final long n) throws IOException {
        if (n < 0) {
            throw new IllegalArgumentException("Negative skip length: " + n);
        }

        // skip in chunks of 512 bytes
        final byte[] b = new byte[512];
        long todo = n;

        while (todo > 0) {
            int len = (int) Math.min(b.length, todo);
            len = this.read(b, 0, len);
            if (len == EOF) {
                break;
            }
            todo -= len;
        }

        return n - todo;
    }
34507
@Override
  public void write(byte[] b, int off, int len) throws IOException {
    inner.write(b, off, len);
  }
850193
public boolean isAffected(byte b) throws IllegalArgumentException {
        if (this.status.length < (b / 8)) {
            throw new IllegalArgumentException("Argument exceeds status!");
        }
        int index_l = (b / 8);

        int index = b % 8; // number of bit to lit... ech
        int n2Pattern = (int) Math.pow(2, index); // hmm no int pows... sucks
        return (this.status[index_l] & n2Pattern) > 0;
    }