Simple line reader question

I'm trying to implement a line reader class, but my code does not seem to compile, giving the error that there is no return statement. here's my code.
import java.io.*;
import java.util.*;
public class InputLineReader
     public static String lineRead (BufferedReader buff)
          try {
          return buff.readLine();
     catch (IOException e)
          System.out.println("IO Error");
}

You have to return after try..catch statement.
import java.io.*;
import java.util.*;
public class InputLineReader {
    public static String lineRead (BufferedReader buff) {
     String line = null;
     try {
         line =  buff.readLine();
     } catch (IOException e) {
         System.out.println("IO Error");
     return line;
}Regards,

Similar Messages

  • Simple Line Chart - Values over time

    A simple line chart displaying a set of values over time would seem to be a very easy report to design. I'll be darned if I can see how to design it. Can anyone shed some light?
    I have provided links to a report and a spreadsheet which is the report datasource. My actual report will use SQL Server as its datasource. I am providing ths excel based example for the sake of protability.You will need to set the datasource location after saving the files to your hard drive.
    I can get the lines to draw properly, what I cannot figure out is how to specify the datetime values for the x axis. The column I would like to use on the x-axis is called DerivedLoggingTime.
    I'd also like to get control of the logarithmic algorithm used to formulate the y-axis values. I am not always happy with the values that the log algorithm comes up with.
    Any help is greatly appreciated.
    [Link to report|http://www.usol.com/~joe/linechart.rpt]
    [Link to spreadsheet|http://www.usol.com/~joe/AnalysisResults.xls]
    Another discovery while working on this report - our database will be SQL 2008 and  we are making use of the datetime2 datatype. CR appears to be treating this datatype as text. So when working with the SQL based datasource, I had to cast datetime2 columns as datetime in order for CR to see the columns as datetime instead of text. This is fine in this instance because the granularity of the datetime values for this particular report does not require datetime2, but that will not always be the case. CR will need to recognize the new datatype.
    Edited by: Joe Sytniak on Jul 17, 2008 5:37 PM

    Hi Joe,
    The Date Axis Line Chart of the Numeric Axis Type Chart, can be used to display data on a regular interval of days, Months and Years. The information displayed can unfortunately not be more granular that days.
    This type of chart is generally used when the data is recorded on irregular intervals in the database, and to make sense of the information stored it needs to be displayed at regular intervals.
    Since the data stored in your data source seems to be stored every 4 minutes, it will not be necessary to use this type of chart. I will suggest to use the regular line chart instead.
    To create a line chart using your date time field and value:
    1. Select "Chart" under the menu "Insert"
    2. Insert the chart on your report in the desired section.
        ( Group Header # 3 in your case. )
    3. In the "Chart Expert" window, under the tab "Type",
        change the chart type to a line chart by selecting "Line" in
        the "Chart Type" list.
    4. Under the tab "Data", add the database field that contains the Date Time information under the "On change of" list.
    (In your case, add the "DerivedLoggingTime" database field)
    5. To display the data for each minute, select the database fields you just added under the "On Change of" list, and
    click on the button "Order". In the "Chart Sort Order" window,
    select "For each minutes" in the "Section will be printed" drop down list, then click "OK"
    6. Add the field you want to display the value in the "Show Value List", then click "OK"
    Now it will display a line chart as desired, but since there is a lots of data point on your chart, the x axis date time labels will overlap each other. To avoid  this situation, I will suggest to skip labels.
    To format a chart to skip labels:
    1. In the "Preview" tab of the report, select one of the x axis label, and right click on it. In the contextual menu, select "Group (X) Axis Options..."
    2. In the "Group (X) Axis Settings" window, under the tab "Layout", check the option "Skip Group Labels" and set the value to 15 for example.
    Now, it will display the date time label at every 15 data point.
    As for your question on how get control of the logarithmic algorithm used to formulate the y-axis values, we unfortunately do not have much control over it other than:
    - Entering static values, or
    - Checking or Unchecking the option "Use Logarithmic scales"
    The above options are available on the y axis. To change those options:
    1. In the "Preview" tab of the report, select one of the y axis label, and right click on it. In the contextual menu, select "Group (Y) Axis Options..."
    2. In the "Group (Y) Axis Settings" window, under the tab "Scales", you will see the following options:
    - Minimum Values
    - Maximum Values
    - Use Logarithmic scales
    I will suggest to check the option "Use Logarithmic scales"
    Finally, as for the issue you discovered where SQL Server 2008 data type DateTime2 is converted to a string in Crystal Reports 2008, it is important to note that SQL Server 2008 hasn't been released yet, therefore it has not been tested in Crystal Reports 2008. Once SQL Server 2008 is released, I will suggest to test it again using the ODBC driver provided with this new version. 
    At this point I am assuming that this is happening because it is a new data type and an unknown data type get converted to string.

  • Hdajackretask line out question

    Hi there!
    I want to remap (retask) headphones jack (3.5 mm) to act as line out.
    Trouble is in that I can choose only from "Line out front", "Line out back", "Line out center", "Line out side", but I want just one simple "Line out" to connect to 1 channel amplifier.
    What can I make in such situation? Will "Line out front" be suitable in such situation? May be "Advanced options" checkbox will help (but I don't know how to configure port in this mode)?
    Thanks.

    Better audio would be relative.  Remember the audio will only be as good as the weakest link in the chain.  If you are prepared to use high quality audio files, amplification and speakers or headphones, then yes, you can get better audio performance.  But if you are only planning to make a partial commitment, you aren't going to get any gain and will just waste your money.
    Here is an example of a iPhone/iPad/iPod D/A device on Amazon.  I'm sure there are many more you can check out.
    http://www.amazon.com/Nuforce-ICON-IDO-SILVER-Audiophile-Grade-Headphone-Devices /dp/B005LRTH5Q/ref=sr_1_7?ie=UTF8&qid=1414176166&sr=8-7&keywords=ipod+lightning+ cable+headphone+amps
    You don't want to go too cheap because a poor quality D/A converter may make the audio worse.  What devices like this does, is take a function that your iPad already does through built-in circuitry and do it externally with the assumption that you can buy a D/A converter and amplifier with higher quality components than those used by Apple.

  • HOW TO display a simple line of text if the user isn't logged in and not display it if they are?!?!?

    there must be a way to display a simple line of text (or a link) if the user isn't logged in (as wholesale customer), and not display it if they are?!?!?
    it's a basic kind of <php echo> var type of function.... there must be an equivalent in this BC system..... anyone?!?!?     PLEASE!
    thank you
    Chris.

    ok, after chattting with LIVE SUPPORT i've discovered {module_isloggedin}
    now i just need to integrate it into my Online Store modules!

  • In Preview, the simple line annotation seems to have been removed. When I select the tool, there is an arrow annotation instead of the simple line earlier.

    The simple line annotation in the Preview Application seems to have been replaced rather oddly by an arrow. I wish to use the simple line in a PDF document without an arrow at the end. Its a very important annotation that I use very frequently.

    Choose line width at the top of this pull-down in the Annotate tools. Choose simple lines, right, left or two-way arrows at the bottom of the pull-down...

  • Simple lines now not compiling

    I added the Netbeans profiler to my app this morning. I don't know if that has anything to do with my problem specifically, but for some reason, simple lines that I add in are acting very weird now. For instance, the below line asks for another " )". Without this line, the program compiles fine so I know it's not the result of another () not being closed. Both variables are strings. What am I not seeing?
    System.out.println("Path of " + userURL "is " + pathURL);

    yeah, I can go to every closing bracket in Netbeans and it will highlight the opening one. They are all there. I'll post the if block that I'm referring to to see if someone sees something that I don't:
                                if(tempURL.trim().startsWith(baseURL.toString()) && !tempURL.trim().toLowerCase().endsWith("js") && !tempURL.trim().startsWith("#"))
                                    try
                                        HttpURLConnection con = (HttpURLConnection) pageLinks.getRequest().getURL().openConnection();
    int respcode=con.getResponseCode();
    con.disconnect();
    if (respcode != 200 || respcode != 202)
    FileWriter writer = new FileWriter("Not_Found.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    else
    WebLinkQueue.add(pageLinks[i].getRequest().getURL());
    try
    FileWriter writer = new FileWriter("Processed.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");
    catch(java.net.MalformedURLException me)
    logger.debug("pageLinks HTTPCon block: " + me.getMessage());
    catch(java.io.IOException ie)
    logger.debug("pageLinks HTTPCon block: " + ie.getMessage());
    else if(!tempURL.trim().startsWith("#") && tempURL.trim().startsWith(baseURL.toString()));
    notProcessed.add(pageLinks[i].getRequest().getURL().toString());
    try
    FileWriter writer = new FileWriter("Not_Processed.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");
    else if(!tempURL.trim().startsWith("#")) //error here
    try
    FileWriter writer = new FileWriter("External.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");

  • I want to make a simple line chart

    i want to make a simple line chart using the data in two nonadjacent columns.
    it seems that the easiest way to do this is to export the sheet to google docs and use THEIR charting, which is a two-click deal.
    is there an easy way to do this in numbers?
    my impression:
    numbers:
    very fancy, super pretty, easy to modify APPEARANCE, difficult to use actual charts. custom paint job on a junker
    googledocs:
    available everywhere, basic, more difficult with actual data flexibility, but you can use what you've got.
    the whole emphasis on numbers seems to be how pretty i can make displays, but not a lot of emphasis on making it easy to make things work.
    can anyone shed some light on how to make this simple instead of pretty?

    You can definitely use the technique I mentioned to order the columns to make it easy to chart:
    Here I created a table (the top one) to hold the original data and make a second table (the lower one) to pull data into two adjacent columns:
    The bottom table, as I said pulls data from the top data table:
    Then highlight the data in the table to chart, and selec the chart type from the menu (I suggest the bar chart which is the first item in the chart tool menu):
    I made up this data and mean it to be no reflection on your running ability 

  • Simple line drawing project in swing

    hi folks,
    i want to write a simple line drawing project. it has a JPanel, a JFrame and JButton.
    JPanel and JButton are on JFrame. When Button is clicked,
    a line will be added to JPanel but previous lines which have been added are not removed on JPanel.
    Could you please help me?

    i wrote below codes but it adds first line but when click button �n order to add line, it is not adding line. Please help and thanxs...
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.geom.Line2D;
    import java.util.Enumeration;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.WindowConstants;
    import javax.swing.SwingUtilities;
    public class NewJFrame extends javax.swing.JFrame implements ActionListener {
         private JButton addButton;
         MainPanel mainPane ;
         public Vector lines ;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        NewJFrame inst = new NewJFrame();
                        inst.getContentPane().add(new MainPanel(inst.lines));
                        inst.setLocationRelativeTo(null);
                        inst.setVisible(true);
         public NewJFrame() {
              super();
              initGUI();
              lines = new Vector();
              lines.add(0, 30);
              addButton.addActionListener(this);
         private void initGUI() {
              try {
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                        addButton = new JButton();
                        getContentPane().add(addButton, BorderLayout.SOUTH);
                        addButton.setText("ADD");
                        addButton.setPreferredSize(new java.awt.Dimension(71, 21));
                   pack();
                   setSize(400, 300);
              } catch (Exception e) {
                   e.printStackTrace();
         @Override
         public void actionPerformed(ActionEvent e) {
              if(e.getSource() == addButton){
                   lines.addElement(Integer.parseInt(lines.get(0).toString())+30);
                   mainPane.repaint();
    class MainPanel extends JComponent {
         Vector tempLines ;
         MainPanel(Vector lines){
              tempLines = lines;
              setBackground(Color.white);
         public void paintComponent(Graphics g) {
              Enumeration enumeration = tempLines.elements();
              while(enumeration.hasMoreElements()) {
                   Integer point = Integer.parseInt(enumeration.nextElement().toString());
                   Line2D line = new Line2D.Double(30, point, 200, point);
         Graphics2D g2d = (Graphics2D)g;
         g2d.setStroke(new BasicStroke(5));
         g2d.draw(line);
    }

  • Looking for simple line drawing program [Solved]

    I am looking for a simple line drawing program with the following features :
    command-driven ( line, circle, ellips and such commands)
    used commands need to be exportable or copyable
    2D
    a canvas with arbitrary size
    libreoffice Draw, Koffice Karbon and xfig are not suitable for this.
    I have some experience with Autocad, but no access to that anymore.
    Any suggestions ?
    Last edited by Lone_Wolf (2011-04-03 13:34:57)

    keenerd wrote:For really simple stuff (and extremely keyboard driven!) I'll make an SVG by hand.  Any xml aware text editor works great.  The spec is pretty simple.  Use an image viewer that will automatically redraw when the SVG is updated.
    +1 http://www.w3schools.com/svg/tryit.asp? … 1&type=svg
    I think TeX can draw alright.
    A bunch of links - never tried them, don't know if they even work:
    http://www.ribbonsoft.com/qcad.html
    http://www.linuxcad.com/
    http://ipe7.sourceforge.net/
    Last edited by karol (2011-04-03 01:12:44)

  • Simple Crop tool question... how do I save the crop section?

    Hi,
    I have a very simple crop tool question. I'm a photoshop girl usually... so Illustrator is new to me. When I select the crop section I want... how do I save it?... if I select another tool in the tool panel, the crop section disappears and I can't get it back when I re-select Crop tool. If I select Save as... it saves the whole document...and not just my crop section.
    Like I said, simple question...but I just don't know the secret to the Illustrator crop tool.
    Thanks!
    Yzza

    Either press the Tab key or F key.

  • A simple Line...

    I am very new to the swing enviroment and would be very grateful is someone could show me the simpliest way to create a simple line using the 2D package.
    Thank you.

    Hi friend.
    I suggest that you should search in the forum for similar topics or the internet.
    http://java.sun.com/docs/books/tutorial/2d/overview/index.html
    http://forum.java.sun.com/thread.jspa?forumID=20&threadID=683873
    Good luck with you work ;)

  • Simple line graph problem

    Hi there,
    I want to create a very simple line graph, containing 1 line. Therefore i create a Graph.LINE_VERT_ABS type Graph and add the data using myGraph.setLocalRelationalData(al ArrayList). This arraylist contains values in the form of
    setname jan 12.2
    setname feb 14.5
    setname march 8.1
    etc
    When i do this, I get the errormessage: "The data has an insufficient number of columns. This graph type requires at least 2 columns of data. The data provided has one column.".
    When i add another dummy value to the arraylist:
    dummy dummya 1
    dummy dummyb 2
    the graph displays correctly, but only with a additional line for the dummy values, also in the Legend.
    What am i doing wrong. Surely it is possible to display just one line in the Graph??
    Any help is appreciated.
    Linda

    In the arraylist, setname identifies a column. By default, columns are plotted as groups, or different points along the horizontal axis. In order to have a line or area graph, you need two groups. The data that you are passing has 1 group and 3 series. You should pass it as follows:
    jan setname 12.2
    feb setname 14.5
    march setname 8.1
    etc.
    Passing data like this will give you three groups (jan, feb, march) and one series (setname).
    By the way, what version of BI Beans are you using and how did find out about setLocalRelationalData? That API was never publicly released. It was replaced by setTabularData (same method renamed) and exposed in 9.0.3.
    BI Beans Product Management

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

  • Convert a line read from text file into string

    how to convert a line from text file into string?
    i know how to convert to numbers,
    private int  parseLine1(String line) {
              StringTokenizer tokenizer = new StringTokenizer(line);
                  value1 = Integer.valueOf(tokenizer.nextToken()).intValue();
                  value2 = Integer.valueOf(tokenizer.nextToken()).intValue();
                 return value1;
                     }but what about charactrs?

    ok, here is my problem, i have a file with a bunch of Xs in it but position function doesn't return a correct value, what's going wrong?
    private int positioni(){
           int i=0;
           int j=0;
           int b=0;
           String line="";
            while(line!= null){
                for(int a=0; a<line.length(); a++){
                    if(line.charAt(a)=='X'){
                        i=a;}
                b++;
                j=b;
                t=line.length();
                line=read(gridFileN);
           return i;
    private String read(String ggridFileN){
             TextStreamReader ggridFile = new TextStreamReader(ggridFileN);
             return ggridFile.readLine();

  • How can I save visited internet pages in cache for off-line reading?

    Hi,
    is there any way to save visited internet pages in cache for off-line reading until I delete them manually or cache is filled completely?
    Thanks,
    Wilfried

    Hello
    you can use this Add-on : https://addons.mozilla.org/en-US/mobile/addon/reading-list
    Enjoy brorowsing!

Maybe you are looking for

  • How can I keep the front and back of a photo together in a single image?

    I'm running PSE 8 on XP with SP3. I'm getting ready to upgrade to PSE 9. My cousin just sent me 24 old family photos. On the back of each photo is a lot of information. Who is in the picture, where it was taken, what the event was, etc. What I'd like

  • Link to download - Enterprise Portal Sneak Preview Version

    Hi Guys, Can somebody send me the link to download Enterprise Portal Sneak Preview Version. Thanks, mini

  • Apple TV, Airport Extreme and Disk Sharing

    Can I put all my photos, music, vidoes, etc. on a USB drive connected to my airport extreme and NOT need a Mac on to play music, etc? In other words, will the Apple TV see the shared USB drive and pull from there?

  • EBP to SUS Vendor

    We replicate the vendors from ECC and then we go in the transaction bbpmainint to mark the vendor as portal vendor. Once we do that it is suppose to assign the vendor a supplier market place role. 'CRM007' in table BUT100 . But the table is not getti

  • How to do this Update

    I need to add a 'serial_no' column to a table. The existing PK consists of non-consecutive values. The serial_no column which should follow the ordering of the PK and increased by exactly 1 for the next pk. How to write this UPDATE? I cannot use 'UPD