Finding alternative to deprecation

hi, i'm learning java sockets programming and i stumble upon these codes...
import java.net.*;
import java.io.*;
public class TestClient2{
     boolean connStat=false;
     Socket sock=null;
     DataInputStream streamIn=null;
     DataOutputStream streamOut=null;
     public TestClient2(){
          try{
               sock=new Socket("127.0.0.1",1024);
               System.out.println("Connected to server");
               streamIn=new DataInputStream(System.in);
               streamOut=new DataOutputStream(sock.getOutputStream());
               while(!connStat){
                    try{
                         String line=streamIn.readLine(); //THE OFFENDING DEPRECATED STATEMENT
                         streamOut.writeUTF(line);
                         streamOut.flush();
                         connStat=line.equalsIgnoreCase("bye");
                    catch(Exception err){
                         System.out.println(err);
                         connStat=true;
               if(streamOut!=null)     streamOut.close();
               if(streamIn!=null)     streamIn.close();
               if(sock!=null)          sock.close();
          catch(Exception err){
               System.out.println(err);
     public static void main(String[]args){
          TestClient2 tc2=new TestClient2();
}as u can see, the statement with caps comments is the cause of the deprecation during compilation
i tried to use readUTF, but as a result, the program will just hang
do u guys know of a better alternative to that statement?
thx,
gildan2020

See the API docs whenever you have a deprecation warning.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInputStream.html#readLine()
It says to use BufferedReader.readLine().

Similar Messages

  • Looking for alternative to deprecated SortCriterion

    JDev 11.1.1.0.1 + ADF BC + ADF RC
    I have a requirement to be able to access the sort criterion of a rich table from the backing bean of the page that contains the table.
    Currently, I am using the following code I originally wrote in JDeveloper 10.1.3.4 to do so:
    SortCriterion criterion = (SortCriterion)getTechDataTable().getSortCriteria().get(0);
    String sortBy = criterion.getProperty();
    However, the oracle.adf.view.rich.model.SortCriterion object is apparently deprecated, and so is the org.apache.myfaces.trinidad.model.SortCriterion object.
    So, my question is, what alternative is available? As I understand it, objects aren't deprecated unless there is a viable alternative.
    Does anyone know the alternative to use in place of the deprecated oracle.adf.view.rich.model.SortCriterion?
    Thanks All and Happy New Years!

    Where did you find the info that org.apache.myfaces.trinidad.model.SortCriterion is deprecated?
    in the 1.2.11 API docs I found nothing about a deprication.
    For me it looks like you just can use org.apache.myfaces.trinidad.model.SortCriterion instead of oracle.adf.view.rich.model.SortCriterion.
    Timo

  • Alternative for deprecated MethodBinding?

    Hi,
    I was trying to setValueChangeListener on a UI component created using Java and found that the MethodBinding arguement it takes comes from a deprecated class javax.faces.el.MethodBinding.
    What alternative do I have instead?
    Thanks...
    -inder

    similar issue at setActionListener still only takes depreciated MethodBinding, not MethodExp

  • Alternative to (Deprecated)HttpRequest

    Now that most of the javafx.io.http package is Deprecated what is the alternative.

    http://download.oracle.com/javase/7/docs/api/java/net/URL.html
    * Use this to be certain string data is sent in ascii format.
    static final Charset ASCII_CHARSET = Charset.forName("US-ASCII");
    try {
         * Create the URL object.
        URL url = new URL("http://www.somwebsite.com/thepage.html?some_key=some_value");
        //Create the connection object from the url object.
        URLConnection connection = url.openConnection();
        //Since this is an Http URL, we can cast the URLConnection to something more specific.
        HttpURLConnection httpConnection = (HttpURLConnection) connection;
        //Tell it we are reading and writing.
        httpConnection.setDoInput(true);
        httpConnection.setDoOutput(true);
        //We are sending post headers, so set this appropriately.
        httpConnection.setRequestMethod("POST");
        //Tell it the MIME format of the request.
        httpConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        //Send the post headers.
        OutputStream outputStream = httpConnection.getOutputStream();
        outputStream.write("username=myusername&password=mypassword".getBytes(ASCII_CHARSET));
        outputStream.close();
        //Recieve whatever data here.
        InputStream inputStream = httpConnection.getInputStream();
        inputStream.close();
    } catch (IOException ex) { //Something went wrong. Tell us what.
        ex.printStackTrace();
    }I was a little distracted when writing this, so there may be errors. If you want to send large files, it gets much more complicated. Had to build my own class for that.
    Edited by: aidreamer on Jun 17, 2011 6:38 PM

  • How do I find out if a class file has deprecated functions

    Currently I'm having problems with a old Visual Cafe class.
    It is definately using deprecated awt funcions.
    My question is..
    1) Without the source code how do I find out what deprecated functions the CLASS file is using.
    2) Has any deprecated class been truly scrapped ? If so, I cannot find
    it in the JDK API documentation or the java.sun.com search engine..

    Here is what I did, to answer your question. I unzipped the symantec jar and used a decompiler (JAD works fine, or cavaj) to create an entire src tree (you can do this with 1 command). Then, compile using your target version of Java. There are well over 100 warnings (with -deprecation on) ranging from Cafe's use of awt.Component methods (mostly), Thread.suspend in their Timer class, to the use of java.util.Date in their Calendar component.
    Cheers!

  • InvokeAction deprecated: Alternative?

    Hi
    We are using JDeveloper 11.1.2.1
    We want to change the invokeActions that we are using in an application, but only find alternatives to execute actions on page load with method calls. We have invokeActions to execute actions inside of a page to refresh iterators and re-execute queries.
    For example, on select a row in a af:table, to re-execute query and refresh a dependant component.
    Which is the alternative in this case? Override the af:table selectionListener?
    Thanks

    You can either use a task flow and call the method as method activity before navigation to the page, or you call your methods from a bean. 
    Your use car can be done using a generic take selection listener like http://www.oracle.com/technetwork/developer-tools/adf/learnmore/23-generic-table-selection-listener-169162.pdf
    Timo

  • How do I find out user and domain names in WL7.0 security

    Hi,
    I'm moving to WL7.0 security and now weblogic.security.acl.Security.getCurrentUser()
    that worked in CompatibilityMode throws NullPointerException. What is the alternative
    to deprecated weblogic.security.acl.Security in the new Weblogic security framework?
    Also, how can I find the current domain name?
    Thanks,
    Michael.

    "Michael Bogomolov" <[email protected]> wrote in message
    news:3ec515ae$[email protected]..
    >
    Hi,
    I'm moving to WL7.0 security and nowweblogic.security.acl.Security.getCurrentUser()
    that worked in CompatibilityMode throws NullPointerException. What is thealternative
    to deprecated weblogic.security.acl.Security in the new Weblogic securityframework?
    >
    See getCurrentSubject in
    http://e-docs.bea.com/wls/docs81/javadocs/weblogic/security/Security.html
    getCurrentUser only works in compatibilty mode

  • Need to generate html report on deprecated api

    Hi All,
    How do I write a generic tool that can print a report in html format of all the deprecated methods of a class and their count. Are there any freely downloadble tools that does this. What is the best way to do this if I have to write on my own.
    Thanks & Regards,
    Kumar.

    Yep:
    1) Get hold of the source code for x-doclet tags and tinker around with them so that you can find all the deprecated tags in your system.
    2) Write some code yourself that picks up all your files and searches for instance of the deprecated tag
    3) Use javadoc to generate javadoc. Parse the output HTML using DOM/SAX parsers to find deprecated methods
    Unfortunately, a class file never knows that a method is deprecated - so you cant use reflection to find deprecated methods (nor can you use BECL)

  • MAil adapter alternative

    Dear all,
    My requirement is that we need to read attachment in the mail,read the content of the attachment and send it to proxy.
    I know this functionality can be achieved using mail adapter,due to security reasons ,we were asked to find alternative.
    Pls let me know how to achieve this functionality.
    Thanks,

    Hello,
    Check below link.
    http://help.sap.com/saphelp_nw04/helpdata/en/45/a4f8bbdfdc0d36e10000000a114a6b/content.htm
    http://www.saptechno.com/component/sapnotes/?task=detail&note=1303363
    Regards,
    Phani

  • Alternative for group by

    Hi guys i need some help with the logic. As an example, i have table with Account and product columns. So each Account can have multiple products. Now i need SQL to see Accounts that have only Product.
    One way of doing it is by doing a groupby and having count(Account) =1. I need an alternative for this. Please help me with your ideas. Thanks in advance.

    Alberto Faenza wrote:
    Is there any reason why you don't want to use group by or just your curiosity to find alternatives?Simple case would be: "I need to select everything from account table where account has multiple products". And between:
    SELECT  *
      FROM  YOUR_TABLE
      WHERE ACCOUNT IN (
                        SELECT  ACCOUNT,
                          FROM  YOUR_TABLE
                          GROUP BY ACCOUNT
                          HAVING COUNT(*) > 1
    /and
    SELECT  *
      FROM  (
             SELECT  ACCOUNT,
                     COUNT(*) OVER(PARTITION BY ACCOUNT) CNT
               FROM  YOUR_TABLE
      WHERE CNT > 1
    /I prefer the latter.
    SY.

  • How do I find a hidden folder on a volume in target mode from another computer? running leopard

    I have a MacBook 2.13 ghz running lion that has become currupted. I have to reinstall lion but don't want to lose all my data. Some of which is in a hidden library folder. I am unable to find the folder from the leopard Mac on the MacBook in target mode. Is there a way to find the folder so that I can back up its contents?

    Enable Finder to Show Invisible Files and Folders
    Open the Terminal application in your Utilities folder.  At the prompt enter or paste the following command line then press RETURN.
    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder
    To turn off the display of invisible files and folders enter or paste the following command line and press RETURN.
    defaults write com.apple.finder AppleShowAllFiles FALSE
    killall Finder
    Alternatively you can use one of the numerous third-party utilities such as TinkerTool or ShowHideInvisibleFiles - VersionTracker or MacUpdate.

  • Cut & paste doesn't work most of time in finder

    anyone knows why and how to fix it?

    "Cut" is available when you have a part of a filename selected - it cuts the text from the filename as you expect.
    I disagree with Apple's design decision here too - it's an annoyance, but you'll just have to live with it. Or use an alternative to the Finder - http://www.simplehelp.net/2006/10/08/10-os-x-finder-alternatives-compared-and-re viewed/
    /edit: Or more recently, http://mac.appstorm.net/roundups/utilities-roundups/5-alternatives-to-the-os-x-f inder/

  • Cut and paste files by dragging in finder is only possible by giving my password. in the menu bar cmd x is depicted in grey so not available. How to c

    I can only cut and paste files in finder (with the mouse) when i give my password at every single action. This is too time consuming of course. The option in the menue bar cmd x is depicted in grey in stead of black, thus not possible. How to solve this? I use the lion version.

    Wow, thanks for the tip!  Should've known Apple wouldn't have made it any easier for us to tap this hidden function. 
    In the meantime I've gone back to Snow Leopard on my MacBook Pro 13" 2010 model, where I use PathFinder as a Finder alternative that allows cutting and pasting, among other features I like (such as enlarging the default sidebar icon sizes in 10.6.8).  My battery life was cut in half with Lion and most of the new features have been supplemented in Snow Leopard by third-party utilities.  The only missing feature is iCloud, but I'm convinced Apple will backhaul this functionality to Snow Leopard at some time.  Otherwise frustrated Snow Leopard users will move to Windows to move up to the cloud!

  • Alternative to SAPBexqueries hiddensheet in BI

    Hi,
      In our company,we are working on upgrading Bex workbooks from 3.5 to 7.0. in 3.5,there are Macros written using SAPBexqueries(Hiddensheet)to format and print workbooks , which is no more existing in BI. so I am trying to find alternative way of accessing the hidden sheet data in Macros(Visual Basic Editor) in the latest version [BI].
    Any king of input would be highly appreciated.
    Thanks,
    Neel
    Message was edited by:
            Neelima Challagulla

    I am also looking for a solution to this problem.  We use SAPBexfilters as well.  Did you find an answer?

  • Alternative Visio Viewer for .vdw files

    Hi, all!
    Since Visio viewer is not included in STD license Sharepoint 2013, I need to find alternative viewer. 
    Can someone suggest alternatives?

    You can implement something similar using Aspose Visio Diagram:
    http://www.aspose.com/docs/display/diagramnet/Export+Diagram+to+HTML It's a commercial product, and I'm not affiliated to them in any way, there are probably a lot more options out there, but this one does the job nicely.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

Maybe you are looking for

  • I would like to know if my phone has been hacked in any sort of way.

    I found two contacts of people in my contact book who I never added into it. I then got a new phone, but a few days later the same two contacts reappeared. Both of the times that I have found them on my phone the numbers have included contact photos.

  • ITunes and Front-Row no longer in Sync

    Since I moved my whole iTunes library to an external drive, Front-Row is no longer showing if a TV Show is new or not. And it won't update the iTunes counter for that show. The video-podcasts are working correctly. When I download a new one, it shows

  • Embedding font in app

    Hi, I'm using LTC Bodoni (via TypeKit) on my website and now I'm working on my digital portfolio: basically HTMl5+CSS, packed with Baker Framework to be published on Apple Store. I would use the font with @font-face. I'm wondering if the licence of B

  • Adobe InDesign CS5.5 and CS6 keep crashing

    InDesign CS5.5 and CS6 keeps crashing while working on the documents. It's hard to identify the patteren when it's crashes. I deleted the SING/DataStore. Used FontNuke to clear all font caches but none of those helps. CS 5.5 and CS6 are installed on

  • Flash CS3 Video Encoder

    I When I use "Flash CS3 Video Encoder" I get a watermark that says "created with flip4mac WMV demo". It Is not suppose to come ready to be used with the flash version? No where says that I have to buy a third part software. Can somebody please tell m