Closing Reader without Closing InputStream

Currently, I have a method :
void method(InputStream stream) {
    // Create UTF-8 reader by wrapping up the stream.
}The reason I do not want to have method to accept Reader is that, I want my own method to have own control to decide what type of encoding should be used.
The problem is, whenever I close the Reader, InputStream will be closed as well. This is not my intention. As InputStream is "opened" by the caller. Hence, the closing operation on InputStream shall be done at caller side.
Is there any way I can close the Reader in "method", without closing the InputStream passed by caller?
Thanks.

The problem is, whenever I close the Reader, InputStream will be closed as well.So don't close it.
This is not my intention. As InputStream is "opened" by the caller. Hence, the closing operation on InputStream shall be done at caller side.So don't close it.
Is there any way I can close the Reader in "method", without closing the InputStream passed by caller?Don't close it.

Similar Messages

  • Closing InputStream / InputStream Reader

    Hello,
    I need suggestion regarding closing InputStream / InputStream Reader.
    If I have these two lines of code below:
    InputStream inStream = ...;
    InputStreamReader inStreamReader = new InputStreamReader (inStream );Is it necessary to do both:
    inStream.close();
    inStreamReader.close();I can't confirm but some people say that it is necessary only to do inStreamReader.close() and inStreamReader#close will do inStream#close as well.
    Could somebody please advise?
    Thanks.

    read the close method on inputStream
    [url=http://java.sun.com/j2se/1.5.0/docs/api/java/io/I
    nputStream.html#close()]here. its kind offunny.
    Interesting,
    I've never noticed that before.
    So, InputStream#close method is not necessary at all, isn't it?
    Thanks for the lead Brigand,

  • Question about read method of InputStream

    Hello everyone,
    I am using read method of InputStream to read a stream from a remote machine. The network connection is not very stable (for example, a wireless network whose the signal strength is relatively low). I am wondering if read method returns -1 (which indicates the end of the stream has been reached), and if I invoke read method again on the same stream, is it possible to read any more data?
    I think maybe I can read some more data even if read returns -1 in one time because the connection is not very stable. I am looking for your comments to my problem in my specific situation.
    regards,
    George

    Thanks Adeodatus,
    Doc says This method blocks until input data is
    available, the end of the stream is detected, or
    an
    exception is thrown.
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputS
    tream.html#read()
    I have not found any related parts in documents.
    http://java.sun.com/j2se/1.4.2/docs/api/
    Them's docs.
    if you're using a different version of java, replace
    the underlined portion with your version number.I am using JDK 1.3, and I have found related documents. But I can not find out where can I set timeout value of read operation. I am reading data from an HTTP InputStream. Can you help?
    regards,
    George

  • How do i install adobe reader without installing products from google.

    i dont like google, i dont like a bunch of worthless taskbars crowding my browser. so how do i install adobe reader without installing google products when you dont even give me the chance to say i dont want them?
    It is unethical to force onto people products of any nature that they do not want. i do not want google products so by your installation for adobe reader automatically installing google products without my consent is unethical.

    I don't understand the "forcing" part; the bundled software is clearly optional, and can be unchecked before the download.
    Or using the download link that Michael provided earlier (which is posted at least a dozen times every day in this forum).

  • Installing reader without Adobe Air

    We would like to distribute Adobe Reader without Adobe Air or
    Adobe.com. The command we use to remotely install Adobe Reader is
    "psexec @c:\tmp\systems.txt -u XXXUSERIDXXX-p XXXPASSWORDXXX
    -c -i \\apps\adobe\9.1.0\AdbeRdr910_en_US_Std.exe /sAll /rs /rps"
    Is there a switch we could use to only install Adobe Reader?

    Hi alouis,
    Sounds like your distributing Flash Player within your org, as such, you'll need to license these products for distribution.  Please see the following links for information on licensing the various products for distribution:
    Adobe - Adobe Runtimes / Reader Distribution License Agreement
    Volume distribution | Adobe Reader XI
    Adobe Flash Player Distribution | Adobe
    Adobe AIR Runtime Distribution | Adobe 
    Adobe Shockwave Player Licensing | Adobe 
    Maria

  • How to read out a InputStream from a socket?

    Hei,
    I try to write a programm that should also be accessed via telnet. So I wrote a classe that has a ServerSocket, a Socket, an InputStream and an OutputStream.
    I read out the InputStream via a byte arry, but the inputStream always starts with the first line I entered. How do I empty the Stream? Mark is not supported :(
    So what can I do, to get only the last enty?
    big thx,

    use the other read option, see:[url http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html#read()]InputStream#read
    This allows you to read from an offset.

  • How to open adobe acrobat reader without having to open photoshop?

    how to open adobe acrobat reader without having to open photoshop? i keep getting this message when opening pdf files. "adobe acrobat was installed as part of a suite. to enable adobe acrobat, please start another component of this suite(such as photoshop)

    Are you mixing Adobe Acrobat with the Adobe Reader?
    If you have Acrobat on your computer you need to associate PDFs with Reader to open in it.
    You also need to get the latest security patches for Reader.

  • Open Adobe Reader without Tools menu or Fill & Sign menu

    Windows 7 Ultimate SP 1 (x64)
    Adobe Reader XI 11.0.10
    When I open a PDF file, I often get a menu down the right side of the Adobe Reader window.  Usually, it is the Tools menu; but if the PDF file is a fill-in form, I get the Fill & Sign Tools menu.  Rarely do I need these menus.  Is there an option to launch Adobe Reader without these menus? 

    We ended up finding a registry key which forces this menu to come up each time:
    [HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\AVGeneral]
    “bBrowserDisplayInReadMode”=dword:00000000

  • The drop down menus in Photoshop CC 2014 are too small to read without using the magnifier.  They are OK in Photoshop CC.  I have been unable to find anyplace to adjust the font size.  I have Windows 7 Pro.  Looking at the Photoshop version history, it lo

    The drop down menus in Photoshop CC 2014 are too small to read without using the magnifier.  They are OK in Photoshop CC.  I have been unable to find anyplace to adjust the font size.  I have Windows 7 Pro.  Looking at the Photoshop version history, it looks like this problem comes and goes as Photoshop is updated.  It should be an easy fix.

    Try the Photoshop CC 2014 Preference experimental section 2X UI option

  • How can I install Adobe Reader without also installing Chrome?

    how can I install Adobe Reader without also installing Chrome?

    Download the full offline Reader installer from
    http://get.adobe.com/reader/enterprise/

  • Download update to Reader without Chrome?  Windows 7

    I have Windows 7 Ultimate.  The window that authorizes downloading update 11.0.09 to Adobe Reader had a checked box to authorize downloading Chrome.  I do not want Chrome.  I cleared the checked box.  Just as I clicked to authorize the download I noticed that the box for Chrome had a check again.  How do I get rid of the uninstalled file that includes Chrome?  Where do I find it?  How can I download update 11.0.09 for Reader without Chrome?

    Why did you post this in the forum for "Adobe Reader Touch for Windows 8" ?

  • One of the e-mails in my ipad deletes messages automatically after reading without backup.  what do I do to correct this so that my mails would remain in the inbox after reading for reference purpose

    One of the e-mails in my ipad deletes messages automatically after reading without backup.  What do I do to correct this so that my mails would remain in the inbox for reference purpose?

    As you are on a residential service you have to wait for engineer availability priority is given to Business users as they get a different service level agreement also using a residential line for business use can leave you open for suspension or cancellation of service as it breach's the terms and conditions
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Is there an hd video camera which iMovie can read without format conversion

    Is there an hd video camera which imovie can read without format conversion

    iMovie 11 - cameras supported:
    http://help.apple.com/imovie/cameras/en/index.html?lang=en_US
    iMovie 9 - cameras supported:
    http://support.apple.com/kb/HT3290?viewlocale=en_US
    iMovie 8 Camcorders supported:
    http://support.apple.com/kb/HT1014
    Digital camera RAW formats supported by OS X Lion:
    http://support.apple.com/kb/HT4757?viewlocale=en_US
    Digital camera RAW formats supported by OS X Snow Leopard:
    http://support.apple.com/kb/HT3825?viewlocale=en_US
    iMovie tutorials:
    http://www.apple.com/ilife/tutorials/#imovie
    and also this:
    http://www.kenstone.net/fcp_homepage/imovie_09_stone.html

  • Converting a Reader to an InputStream

    Is there a way to convert a standard Reader to an InputStream just like you can convert an InputStream to a reader VIA the InputStreamReader class.

    Hi,
    No, there's no easy way, and it's probably due to the fact that the reader can perform conversions.
    You can however read the data from the reader, create a String, get the bytes from the string and use a ByteArrayInputStream.. but it sounds bad. Why do you want to convert from a reader to a stream?
    Kaj

  • Unread emails marked as read without being opened

    On my Ipad 2, unread emails are marked as read without being opened. This happens when I open the email from my laptop after using the ipad. There are four email accounts on the ipad and they are all experiencing this. Any idea what is going on?

    I rebuilt it several days ago and no change. I watched what happens and when an email comes in it shows unread and then changes to read immediately. Today, for some reason, the emails started coming in as unread and staying that way. I didn't change anything. ?????

  • How can I download Acrobat Reader WITHOUT bundled junk?

    Question: how can I download Acrobat Reader without the bundled junk?

    Uncheck the bundled 3rd-party software from the standard download link, or use http://get.adobe.com/reader/enterprise/

Maybe you are looking for