Reading Input

I'm having a bit of trouble reading two forms of input. The input is essentially the components of a directed graph.
The first method of input is through a text file. The file is to be formatted like this:
10
15
2 4
3 5
4 8
1 2
The first number is the dimension of the two dimensional graph (in this case a 10 x 10 graph). The second number is the number of paths in the graph. The rest are the coords of the paths in the graph. This isn't so much important as getting these values into an array that I can call through this function.
Here's my unfinished code:
public static void readFromFile(){
          int data = 0;
          int amount = 0;
          StringBuffer datalist = new StringBuffer(amount);
          try{
               Scanner file_scan = new Scanner(new File("graph.txt"));
               while(file_scan.hasNext()){
                    data = file_scan.nextInt();
                    // System.out.println(data);     // This line is here for debugging purposes
                    datalist.append((int)data);
                    amount++;
                    // System.out.println(data);     // So is this one
                    System.out.print(datalist.charAt(amount) + " ");
          catch(Exception e){
               System.out.println("Error: Bad File Input.");
               System.exit(0);
                // Stringbuffer is read into array
                // array is returned
}SInce the text file is always in the same format, the values will be easy to sort once I get them into the array. But I can't get them into the array. Help!
The second for of input is manual. The problem isn't so much as reading the integers but reading them correctly. The way the user inputs the coords of each path is like this:
Enter Edge: 2 3
Enter Edge: 3 5
My question is how to distinguish the integers. I've managed to read them into strings, but how do I separate the integers? using parseInt(), maybe? Please help!

Here I am replying to myself, a testament to how one can learn from their own idiocy. I'm (to my knowledge) inventing a new acronym: lolas (laughs out loud at self).
First off, the second value of the text file will be the size of an array needed to hold all of the vertices. So, what I should do is read the first two lines of the file outside of the loop since they will always be there. THEN I should enter into the loop while(file_scan.hasNext()) and put all of the values into the array which I can then return.
Secondly, nextInt() reads the next integer of the file. So, as I read it I can put it into an array similar to the method I used for the text file input. It all seems so clear now when it's not approaching 1:00am and I'm not panicking and frustrated.

Similar Messages

  • Read Input from console !!!

    Im am very new to java and trying to learn java ..
    Now the problem i have is, I have to read input from console without using the BufferReader method..
    Please tell me how to go about it..
    I have a assignment to complete and im not able to figure out the way out.
    Help ..

    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html
    Read first about the System class provided by Java.
    Select the 'in' method of System class and it will take
    you to the InputStream.
    http://java.sun.com/j2se/1.4.1/docs/api/java/io/InputStream.html
    An essay way of reading input is:
    "value?"=System.in.read();
    Try and see if this works. It will not use the
    BufferReader portion, but it gives you another way
    of reading from the console.

  • Make System.in read input from a command prompt

    How can i make System.in read input from a command prompt which is opened after program
    is started. Please note that program starts without commad promt. Can u plz help?
    sharmila

    System.in DOES read from the command shell that you start the app in.
    What you don't have is a prompt.
    You should know about Java Almanac. There are code samples for simple things like I/O that everyone should know about. There's an example there to help you.
    MOD

  • Problem reading input stream of urlconnection within portal

    Hi,
    This may be a generic server issue rather than portal but since it's my portal app that's displaying the problem I'll post it here.
    Part of my Portal attempts to POST to a remote server to retrieve some search results.
    In environments A & B (both standalone instances) this works fine.
    In environment C this works on the managed instances in the cluster but not the admin instance.
    In environment D (again standalone) it fails, but if I add a managed instance it works from the managed instance.
    The problem I'm seeing is that I get a stuck thread and the thread dump shows it is blocked attempting to read the resulting input from a urlconnection. (Using a buffered input stream).
    I've copied the code to a standalone class that runs fine from the same server(s). I've pasted this code below, the contents of the test() method were copied directly from my webapp (urls changed here for clarity).
    Does anyone know of any securitymanager issues that may cause this?
    Or anything else for that matter?
    Code sample:
    package src.samples;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    public class POSTTest {
         public static boolean test()
         URL url = null;
         try {
         url = new URL
    ("http://hostx:80/myapp/search.html");
         catch (MalformedURLException e)
         e.printStackTrace();
         return false;
         URLConnection urlConn;
         DataOutputStream printout;
         BufferedReader input;
         urlConn = null;
         try {
         urlConn = url.openConnection();
         catch (IOException e)
         e.printStackTrace();
         return false;
         // Let the run-time system (RTS) know that we want input.
         urlConn.setDoInput (true);
         // Let the RTS know that we want to do output.
         urlConn.setDoOutput (true);
         // No caching, we want the real thing.
         urlConn.setUseCaches (false);
         // Specify the content type.
         urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
         // Send POST output (this is a POST because we write then read as per the JDK Javadoc)
         printout = null;
         String body = "";
         try {
         System.out.println("url=" + url.toString());
         printout = new DataOutputStream (urlConn.getOutputStream ());
         String content = "param1=A&param2=B&param3=C&param4=D&param5=E";
         System.out.println("urlParams= " + content);
         printout.writeBytes (content);
         System.out.println("written parameters");
         printout.flush ();
         System.out.println("flushed parameters");
         printout.close ();
         System.out.println("closed parameter stream");
         // <b>Get response data - this is where it blocks indefinitely</b>
         input = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
         System.out.println("got input");
         String str;
         while (null != ((str = input.readLine()))) {
         body = body + str + "\n";
         System.out.println("read input:");
         System.out.println(body);
         input.close ();
         System.out.println("closed input stream");
         catch (IOException e) {
         System.out.println("IOException caught: read failed");
         e.printStackTrace();
         return false;
         return true;
         * @param args
         public static void main(String[] args) {
              System.out.println("Test result= " + test());

    In your recuperar() method, read the FTP input stream into a byte array. (You can do that by copying it to a ByteArrayOutputStream and then getting the byte array from that object.) Then, return a ByteArrayInputStream based on those bytes. After you call completePendingCommand(), of course.
    That's one way.
    PC&#178;

  • How to read input from handheld scanner on a keyboard port

    Hi everybody,
    i have an application that should read input from a scanner.
    If i use a jTextField to input scanned data it works fine.
    the problem is that i don't want to use any text component to input data into it.
    And if i set the jtextField not visible then the focus sustem doesnt work.
    I tried to read a buffered input stream from System.in but it doesnt work.
    If the scanner was installed on a serial port i could use javax.comm to monitor it.
    But unfortunately i must use the keyboard wedge thing...
    Do you have any ideas?
    Thank you in advance

    BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()))
    null

  • How to detect line break while reading input ?

    Hi all,
    I am reading the user input from standard input.
    I want to detect the line break. So that I can stop reading input and proceed processing the string.
    Actually I am getting the SQL query as input and after that I am executing the same by passing it to a function.
    Pl. do reply me.
       Scanner scanner = new Scanner(System.in);             
            while(scanner.hasNext())
                 temp=scanner.next();
                  sql=sql.concat(" "+temp);
                 if(scanner.next=="\n")
                            break;
           System.out.println(sql);
           sqlTool.executeSQL(sql);
    The above is not working properly.

    But if new line comes, what will be it's value?Empty lines are discarded by the scanner.
    Kaj

  • IIOException: Can't read input file!

    Hi all,
    I have a incomprehensible problem. I have a java application wich manipulate images. This application works fine with a desktop environment but when I try to migrate it on production server (without X), a exception is catch...
    javax.imageio.IIOException: Can't read input file!
            at javax.imageio.ImageIO.read(ImageIO.java:1279)
            at FaceplateBuilder.fillImageByClients(FaceplateBuilder.java:95)
            at FaceplateBuilder.createPack(FaceplateBuilder.java:68)
            at FaceplateBuilder.run(FaceplateBuilder.java:39) This is the following code...
    File tmp = new File("/tmp/test.jpg");
    BufferedImage in = ImageIO.read(tmp);The file /tmp/test.jpg exist.
    Here are all tested solutions without success :
    *I've tried to upgrade the java version (1.5.0_14 to 1.6.0_06). 1.6.0_06 is the desktop environment configuration.
    * I read this page: [Using Headless Mode in the Java SE Platform|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/] and I try to launch java with java.awt.headless=true variable.
    * I have install the [X11 dev library|http://javatechniques.com/public/java/docs/hosting/headless-java-x11-libraries.html]. (apt-get install libice-dev libsm-dev libx11-dev libxp-dev libxt-dev libxtst-dev)
    * I have changed the ImageIO code by following :
    Image tmp = loadImageFile("/tmp/test.jpg");
    BufferedImage in = toBufferedImage(tmp);
    public static BufferedImage toBufferedImage(Image image) {
              if (image instanceof BufferedImage) {
                   return ((BufferedImage) image);
              } else {
                   BufferedImage bufferedImage = new BufferedImage(image
                             .getWidth(null), image.getHeight(null),
                             BufferedImage.TYPE_INT_RGB);
                   Graphics g = bufferedImage.createGraphics();
                   g.drawImage(image, 0, 0, Color.WHITE, null);
                   g.dispose();
                   return (bufferedImage);
         public static Image loadImageFile(String imgFile) {
              Image img = Toolkit.getDefaultToolkit().getImage(imgFile);
              MediaTracker mediaTracker = new MediaTracker(new Container());
              mediaTracker.addImage(img, 0);
              try {
                   mediaTracker.waitForID(0);
              } catch (InterruptedException e) {
                   e.printStackTrace();
                   System.out.println(e.getMessage());
              return (img);
         }This code catches a new error...
    java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
            at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999)
            at java.awt.image.BufferedImage.<init>(BufferedImage.java:314)
            at FaceplateBuilder.toBufferedImage(FaceplateBuilder.java:122)
            at FaceplateBuilder.fillImageByClients(FaceplateBuilder.java:95)
            at FaceplateBuilder.createPack(FaceplateBuilder.java:73)
            at FaceplateBuilder.run(FaceplateBuilder.java:44)I think it's the same problem... The Image can't be loaded and I don't know why ! This problem make me crazy so I tried to post here.
    Thanks in advance

    # la /tmp/test.jpg
    -rw-r--r-- 1 root root 148K 2008-07-15 13:19 /tmp/test.jpg
    # ps aux | grep java
    root     19147  0.0  1.8 269716 23848 pts/1    Ssl+ 19:09   0:00 java FaceplateManager     Everything seems good :)

  • ProtocolException: Cannot write output after reading input

    If I use the following code
    this.conn is a database connection while urlConn is a HTTPUrlConnection
    if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
                   {     this.conn.commit(); }
                   else
                        System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
                        throw new MppException(urlConn.getResponseMessage());
                   byteStream.writeTo(urlConn.getOutputStream());I get the following exception
    ProtocolException: Cannot write output after reading input
    if However I change the order and instead use
    byteStream.writeTo(urlConn.getOutputStream());
    if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
                   {     this.conn.commit(); }
                   else
                        System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
                        throw new MppException(urlConn.getResponseMessage());
                   It works fine but in that case there might be a deadloack on the server side since both the client and server in that case try to modify tables on the same db.
    any work arounds???????

    HTTP is a request / Responce based protocole where all the data to be send to the server must be included in the request and then the server send all the data as the responce.
    By the time you read the responce the request is already send and the server have finished processing it. So it is not posible to send more data to the same request.

  • When using URLConnection read input stream error

    hi,
    In my applet I build a URLConnection, it connect a jsp file. In my jsp file I refer to a javaBean. I send two objects of request and response in jsp to javaBean. In javabean return output stream to URLConnect. At that time a error happened.WHY???(Applet-JSP-JAVABean)
    Thanks.
    My main code:
    APPLET:(TestApplet)
    URL url = new URL("http://210.0.8.120/jsp/test.jsp";
    URLConnection con;
    con = url .openConnection();
    con = servlet.openConnection();
    con.setDoInput( true );
    con.setDoOutput( true );
    con.setUseCaches( false );
    con.setRequestProperty( "Content-Type","text/plain" );
    con.setAllowUserInteraction(false);
    ObjectOutputStream out;
    out = new ObjectOutputStream(con.getOutputStream());
    Serializable[] data ={"test"};
    out.writeObject( data );
    out.flush();
    out.close();
    //until here are all rigth
    ObjectInputStream in = new ObjectInputStream( con.getInputStream() );//happened error
    JSP:
    TestBean testBean = new TestBean ();
    testBean .execute(request, response);
    JAVABEAN:
    public void execute( HttpServletRequest request,
    HttpServletResponse response )
    ObjectInputStream in = new ObjectInputStream( request.getInputStream() );
    String direct = (String) in.readObject();
    System.out.prinltn("direct");
    ObjectOutputStream out = new ObjectOutputStream( response.getOutputStream() );
    SerializableSerializable[] data ={"answer"};
    out.writeObject( data );
    out.flush();
    out.close();
    Error detail:
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:729)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:251)
         at TestApplet.postObjects(TestApplet.java:172)

    you have to pay attention to the sequence of opening the streams.
    The following example is: client sends a string to server, and servlet sends a response string back.
    client side:
             URL url = new URL( "http://152.8.113.149:8080/conn/servlet/test" );
             URLConnection conn = url.openConnection();   
             System.out.println( "conn: " + conn );
             conn.setDoOutput( true );
             conn.setDoInput( true );
             conn.setUseCaches( false );
             conn.setDefaultUseCaches (false);
             // send out a string
             OutputStream out = conn.getOutputStream();
             ObjectOutputStream oOut = new ObjectOutputStream( out );
             oOut.writeObject( strSrc ); 
             // receive a string
             InputStream in = conn.getInputStream();     
             ObjectInputStream oIn = new ObjectInputStream( in );
             String strDes = (String)oIn.readObject();server side
             // open output stream
             OutputStream out = res.getOutputStream();  
             ObjectOutputStream oOut = new ObjectOutputStream( out );
             // open input stream and read from client
             InputStream in  = req.getInputStream();
             ObjectInputStream oIn = new ObjectInputStream( in );
             String s = (String)oIn.readObject();
             System.out.println( s );
             // write to client
             oOut.writeObject( s + " back" ); I have the complete example at http://152.8.113.149/samples/app_servlet.html
    don't forget to give me the duke dollars.

  • Problem in reading input form files while parsing them in javacc

    I need to parse a language called DISP (delay insensitive sequential processes) using javacc. I need help with reading the input which we parse, eg for a matched brace example i dont want to just check if all the braces are matched, i also want to do something everytime i read a brace.
    Is declaring tokens and using token.image the only way?
    and can anyone explain what "parser object" "token manager" etc are and how the whole thing works, in simple words. The documents have details but i keep getting getting lost in them

    import java.io.*;
    import java.util.*;
    import javax.comm.*;
    public class SimpleRead implements Runnable, SerialPortEventListener {
    static CommPortIdentifier portId;
    static Enumeration portList;
    InputStream inputStream;
    SerialPort serialPort;
    Thread readThread;
    public static void main(String[] args) {
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM1")) {
    //if (portId.getName().equals("/dev/term/a")) {
    SimpleRead reader = new SimpleRead();
    public SimpleRead() {
    try {
    serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
    } catch (PortInUseException e) {}
    try {
    inputStream = serialPort.getInputStream();
    } catch (IOException e) {}
         try {
    serialPort.addEventListener(this);
         } catch (TooManyListenersException e) {}
    serialPort.notifyOnDataAvailable(true);
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
    readThread = new Thread(this);
    readThread.start();
    public void run() {
    try {
    Thread.sleep(20000);
    } catch (InterruptedException e) {}
    public void serialEvent(SerialPortEvent event) {
    switch(event.getEventType()) {
    case SerialPortEvent.BI:
    case SerialPortEvent.OE:
    case SerialPortEvent.FE:
    case SerialPortEvent.PE:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    break;
    case SerialPortEvent.DATA_AVAILABLE:
    byte[] readBuffer = new byte[20];
    try {
    while (inputStream.available() > 0) {
    int numBytes = inputStream.read(readBuffer);
    System.out.print(new String(readBuffer));
    } catch (IOException e) {}
    break;
    }

  • Bash script read input and feh

    I was trying to make a quick script to organize some pictures using feh to display the picture in question and then using bash to read a character from the keyboard and move to a folder based on that letter. Problem is it opens every image in the folder at the start (which is overwhelming). I want to go image by image.
    heres the simplified script. There would be different if statements for each letter/dir pair
    #!/bin/bash
    ls | while read file1; do #while loop over all images in the dir
    feh $file1 &
    read ch1
    if [[ $ch1 == "e" ]]
    then
    mv $file1 /PATH/hawaii
    echo "moving to hawaii"
    pkill feh
    fi
    Problem seems to be that the script doesn't wait to receive the input $ch1 before moving on to the next iteration of the loop.  Except that when I do something simpler like the following it does seem to wait on the input
    while
       echo '1'
       read ch1
       echo '2'
       echo '3'

    for f in *; do $(feh $f)& read g; if [[ "$g" == "e" ]]; then mv -v $f ../tested; fi;pkill feh; done;
    waits for me to enter something before checking whether to move the image and closing the image and moving to the next.

  • Read input XML Payload in Mapping Program.

    Hi all,
    How can we access the input source XML structure in mapping program?
    Please help me out in this?
    Thanks and regards,
    Kanth.

    Hi,
    yes - how else would we be able to manipulate it ? (map it?)
    if you want the whole payload (in "string") for example
    you need to use java or abap mappings
    if I understand your question correctly
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Barcode reader input to string control

    Hi, 
    I am using a barcode reader that uses keyboard emulation.  The barcode types on the computer the same way a keyboard would.  When I open notepad and use the barcode reader to read a barcode, the following meesage is typed: 
    S/N: 17967
    Lin: 0.591%
    Ph: 1.32deg
    In that exact format.  However, when I try use the reader in labview with a string control the format changes.  The following meassages are printed instead: 
    S/N: 17967mn: 0.591%m: 1.32deg
    S/N: 17967mn: 0.591%mn: 1.32deg
    S/N: 17967mnLin: 0.591%mPh: 1.32deg
    S/N: 17967mn: 0.591%m:1.32deg
    So the format changes.  Sometimes the Lin and Ph are printed other times they are not, spacing in the string changes, and in all cases the carriage return is no longer there.  
    Could you please let me know what might be causing this.  Ideally I would like the message to be read in the same format it is in notepad.  My code is attached. 
    Thanks
    Attachments:
    barcodereader.vi ‏16 KB

    Is there a reason you have a timeout event?  You are not doing anything in there.  So I would remove the timeout (you can just remove the timeout input or set it to -1).
    I'm just thinking that if you set the focus while the scanner is doing its thing is causing the issue you are seeing.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Reading input stream over the tcp socket in unix

    I have a program that reads data from input stream from the socket. If the data is over 1500 bytes it is sent in multiple TCP packets. Whats weird is, if I run the program in windows environment it waits till it receives all the packets but when I run the same program in unix environment it only reads the first packet and go further without waiting for all the TCP packets!!
    The line that reads from input stream is
    datalen = inStr.read(byteBuffer);is there anyway I can make it wait till it receives all the packets on unix system? I do not understand why it works fine for windows in this case but not for unix.
    I'll appreciate any help..
    Thanks

    When the network is busy there can be any amount of dleay between packets. If this is ever 100 ms , then this will break.
    If you send more than one packet per 100 ms you will get two packets at once which will look like one longer packet. Unless you check for this the second packet may get ignored.
    The safe way is to send the packet size before sending the packet. Then on the client read the packet to the correct length. Otherwise you will have a program which just happens to work rather than one which will always work.

  • Read input stream

    My function tried to parse a inputstream(xml format) but I keep getting exception: Exception org.xml.sax.SAXParseException: The root element is required in a well-formed document. I checked my XML format, it looks correct. Is there a way I can print out the input stream but still be able to parse it later with the sam input stream? Thanks.
    public static final Document getDOMTree(InputStream input) throws Exception
    try
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document doc = builder.parse(input);
    return doc;
    } catch(DOMException de) {
    System.out.println("parse error " +de);
         throw new Exception(de.toString());
    } catch(Exception e)
    System.out.println("Exception " +e);
         throw new Exception(e.toString());
    }

    Here's a class that I use for viewing outputstreams in a similar way - you can either adjust it to work as an input stream, or do a quick web search on TeeInputStream - I suspect you'll find some code.
    Cheers,
    - K
    * Copyright (c) 2001 Matthew Feldt. All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided the copyright notice above is
    * retained.
    * THIS SOFTWARE IS PROVIDED ''AS IS'' AND WITHOUT ANY EXPRESSED OR
    * IMPLIED WARRANTIES.
    * TeeOutputStream.java
    * Java Examples In A Nutshell Copyright (c) 2000 David Flanagan
    * Exercise 3-7:
    * Write a subclass of OutputStream named TeeOutputStream that acts like a T
    * joint in a pipe; the stream sends its output to two different output streams,
    * specified when the TeeOutputStream is created. Write a simple test program
    * that uses two TeeOutputStream objects to send text read from System.in to
    * System.out and to two different test files.
    * @author Matthew Feldt <[email protected]>
    * @version 1.0, 02/12/2001 08:23
    import java.io.*;
    public class TeeOutputStream extends OutputStream {
        OutputStream ostream1, ostream2;
        /** sole TeeOutputStream constructor */
        public TeeOutputStream(OutputStream o1, OutputStream o2) throws IOException {
            ostream1 = o1;
            ostream2 = o2;
        public void close() throws IOException {
            ostream1.close();
            ostream2.close();
        public void flush() throws IOException {
            ostream1.flush();
            ostream2.flush();
        public void write(int b) throws IOException {
            byte[] buf = new byte[1];
            buf[0] = (byte)b;
            write(buf, 0, 1);
        public void write(byte[] b, int off, int len) throws IOException {
            ostream1.write(b, off, len);
            ostream2.write(b, off, len);
        /** test class */
        static class Test {
            public static void main (String args[]) {
                final String f1 = "tee1.out", f2 = "tee2.out";
                int ch;
                try {
                    // create a TeeOutputStream with System.out and a file
                    // as output streams
                    TeeOutputStream t1 = new TeeOutputStream(
                        System.out, new FileOutputStream(f1));
                    // create a TeeOutputStream with t1 and a second file as
                    // output streams
                    TeeOutputStream tee = new TeeOutputStream(
                        t1,    new FileOutputStream(f2));
                    // read characters from System.in and write to the tee
                    while ((ch = System.in.read()) != -1) {
                        tee.write(ch);
                    tee.close(); // close the tee
                } catch(FileNotFoundException e) {
                    System.err.println(e.getMessage());
                } catch(IOException e) {
                    System.err.println(e.getMessage());
    }

Maybe you are looking for

  • Using LoadVars in SSAS to send data to a php file

    I am using FMS 4.5 and have a simple application which I want to use to send two strings to a php file. But I get a compilation error whenever I try to assign any value to these objects: Here is main.asc: <code> var variables = new LoadVars(); variab

  • [Solved] No sound out of M Audio 2496

    I have an onboard Intel card and the MAudio card and I just use ALSA. aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: Intel [HD

  • MP4 won't display on apple TV - Sound is working but no pictures

    I have converted some DVD's using Handbrake Software so I can watch them on Apple TV (using Handbrake's 'normal' default output settings). After converting them I added the files to itunes. When I play these files on the Macbook they are great - all

  • Value addition on asset

    Hi, Please let me know how SAP would calculate depreciation in the following business scenario. Jan 1st 2004: An Asset is aquired for $1000. Life time: 3 years Depreciation on Dec 2004: $300 Depreciation on Dec 2005: $300 Value left on asset: $400 On

  • Upgrade to ECC 6.0 & SAP Netweaver 7.0

    Hi, We are right now using ECC 5.0 & Netweaver 2004 (EP 6.0). Since its very old we plan to upgrade in two phases with some time gap between them. The first phase will be upgrading the ERP to ECC6.0 and second phase is upgrading EP 6.0  to EP 7.0. Th