/*
@see javax.servlet.ServletRequest#getInputStream()
356953
@Override
    public ServletInputStream getInputStream() throws IOException {
        if (null != this.inReader) {
            throw new IllegalStateException("Input reader already obtained");
        }
        this.streamActive = true;
        if (null == this.inStream) {
            this.inStream = new RequestBody(this.request.getBody());
        }
        return this.inStream;
    }
407975
public InputStream getInputStream(String strFilename)
    {
        InputStream inStream = Utility.getInputStream(strFilename, this.getApplication());
        if (inStream == null)
        	if (this.getParentSession() != null)
        { 
        	Task task = this.getParentSession().getTask();
        	if ((task != null) && (task != this))
        		inStream = task.getInputStream(strFilename);
        }
        return inStream;
    }
1129980
public InputStream getInputStream() throws APIException, IOException {
        final HttpResponse response = client.get(getUrl());
        HttpClientHelpers.throwIfNotOk(response);
        return response.getEntity().getContent();
    }
607735
@Override
    public InputStream getInputStream() {
        try {
            return property.getBinary().getStream();
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
422160
public InputStream getInputStream() {
        try {
            return connection.getInputStream();
        }catch(SocketTimeoutException e){
            throw new HttpException("Failed URL: " + url +
                    ", waited for: " + connection.getConnectTimeout() + " milliseconds", e);
        }catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
872466
public InputStream getInputStream() throws IOException {
        if (cachedContent == null) {
            cachedContent = mos.getData();
        }
        return new ByteArrayInputStream(cachedContent);
    }
272496
public InputStream getStream() {
        if (stream != null) {
            return stream;
        }
        try {
            return new ByteArrayInputStream(content.getBytes("utf-8"));
        } catch (final UnsupportedEncodingException e) {
            throw new ApiException("UTF-8 encoding not supported", e);
        }
    }
821858
protected OutputStream getOutputStream()
        throws IOException
    {
        if (os == null && server != null)
            os = server.writeChannel(channel);

        return os;
    }
1160310
@Override public final InputStream getErrorStream() {
    try {
      HttpEngine response = getResponse();
      if (HttpEngine.hasBody(response.getResponse())
          && response.getResponse().code() >= HTTP_BAD_REQUEST) {
        return response.getResponse().body().byteStream();
      }
      return null;
    } catch (IOException e) {
      return null;
    }
  }
1106264
@Override
	public InputStream getResourceAsInputStream(String resourceName) throws IOException {

		try {
			return imgRsHandler.getResourceAsStream(resourceName);
		} catch (ResourceNotFoundException e) {
			throw new IOException("The resource '" + resourceName + "' was not found.");
		}
	}
1142410
public InputStream toInputStream() {
        
        String text = toXml();
        return new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8));
        
    }
110895
public static InputStream getInputStreamFromHttp(String httpFileURL) throws IOException {

        URLConnection urlConnection = null;
        urlConnection = new URL(httpFileURL).openConnection();
        urlConnection.connect();
        return urlConnection.getInputStream();
    }
878662
@FFDCIgnore({ PrivilegedActionException.class })
    protected InputStream getInputStream(final File f, String fileSystemSelector,  String location, String classLoadingSelector ) throws IOException {      
        // check file system first like we used to do
        if (f != null) {
            InputStream is = null;
            try { 
                is = (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                    @Override
                    public Object run() throws Exception {
                        if (f.exists()) {
                            return new FileInputStream(f);
                        } else {
                            return null;
                        }
                    }
                });
                
            } catch (PrivilegedActionException e1) {
            }
            if (is != null) { 
                locationUsed = fileSystemSelector;
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "input stream obtained from file system and locationUsed set to: "+ locationUsed);
                }
                return is;
            }
        }        
        // do the expensive classpath search
        // performant: we're avoiding calling getResource if entry was previously cached.
        URL u = Thread.currentThread().getContextClassLoader().getResource(location);  
        locationUsed = classLoadingSelector;
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "input stream obtained from classloader and  locationUsed set to: "+ locationUsed);
        }
        if (u != null) {            
            return u.openStream();
        }
        return null;
    }
537643
public InputStream openInputStream()
    throws IOException
  {
    close();

    TempBuffer head = _head;
    _head = null;
    _tail = null;

    return new TempInputStream(head);
  }
1324134
public InputStream getInputStream(BeanId beanId)
                    throws CSIException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getInputStream", beanId);

        final String fileName = getPortableFilename(beanId);
        FileInputStream result = null;

        try
        {
            result = (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>()
            {
                public FileInputStream run() throws IOException
                {
                    return new FileInputStream(new File(passivationDir, fileName));
                }
            });
        } catch (PrivilegedActionException ex)
        {
            //d248470 begin
            Exception ex2 = ex.getException();
            if (ex2 instanceof FileNotFoundException)
            {
                FFDCFilter.processException(ex2, CLASS_NAME + ".getInputStream", "524", this);
                if (isTraceOn && tc.isEventEnabled())
                    Tr.event(tc, "No file found while trying to activate passivated stateful session bean", fileName);
                throw new StreamUnavailableException("");
            }

            if (ex2 instanceof IOException)
            {
                FFDCFilter.processException(ex2, CLASS_NAME + ".getInputStream", "531", this);
                Tr.warning(tc, "IOEXCEPTION_READING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0024W",
                           new Object[] { fileName, this, ex2 });
                throw new CSIException("IOException reading input stream for stateful session bean", (IOException) ex2);
            }

            throw new CSIException("Unexpected exception reading input stream for stateful session bean", ex2);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getInputStream");
        return result;
    }
806019
@Override
    public InputStream getAsStream() throws BlogClientException {
        final HttpClient httpClient = new HttpClient();
        final GetMethod method = new GetMethod(permalink);
        try {
            httpClient.executeMethod(method);
        } catch (final Exception e) {
            throw new BlogClientException("ERROR: error reading file", e);
        }
        if (method.getStatusCode() != 200) {
            throw new BlogClientException("ERROR HTTP status=" + method.getStatusCode());
        }
        try {
            return method.getResponseBodyAsStream();
        } catch (final Exception e) {
            throw new BlogClientException("ERROR: error reading file", e);
        }
    }
1044942
@Override
    public InputStream getInputStream() throws IOException {
        InputStream inputStream = fileItem.getInputStream();
        return (inputStream != null ? inputStream : new ByteArrayInputStream(new byte[0]));
    }