![]() |
Open text file
One of my teammates is trying to open a text file(.txt) on the robot. We not have found the correct methods.
Please respond! Thank you. :confused: |
Re: Open text file
There is a class called InputStreamReader available in Java ME (robot version) that can read from a file. If you search for InputStreamReader on the internet, you will find some examples of how to use it.
|
Re: Open text file
Quote:
|
Re: Open text file
The best overview of the file read/write code I have seen is available in [1] around slide 7 with example code.
[1] http://www.usfirst.org/uploadedFiles...FRCKickoff.pdf |
Re: Open text file
Okay i got the FileConnection file = (FileConnection) it says unreported exception java.io.IOException must be caught or declared to be thrown,and when i do the try catch if still says that.
As well as i can't(when it is put as FileConnectionfile = new File Connection();) is says that the sunsquack is abstract and cannot be instantiated. Any ideas as what to do please? If anyone has actual code to open a (.txt) file on netbeans it would be deeply apprectiated! Thank you. |
Re: Open text file
we've looked at that, but we are still having issues. we want to open a text file that has a large number of double numbers seperated by newlines. the totoral posted are more directed at outputting(which is nice though) any other totorals or sites?
ty all in advance |
Re: Open text file
This interface is implemented on our version of Java:
http://developers.sun.com/mobility/a...ileconnection/ I'd assume that they wouldn't reinvent the wheel (or in this case, the API) I've used that API for TCP Sockets |
Re: Open text file
we has this as code, but it only reads every other character.
ex. in text file: 1234.5678 reads out: 2457 i have checked the character encoding, and it seems to be in ASCII. but, the read char is in Unicode. so i outputed the raw bytes, and converted it into ASCII, and the output just was the ASCII reprisentation. DataInputStream dataStream=new DataInputStream("file:///FTPtest.txt"); char[] c=new char[9]; for (int i=0;i<9;i++) { c[i]=dataStream.readChar(); } System.out.println(new String(c)); any suggestions? found it.... nvm.... *face palm* |
Re: Open text file
this is how we have been able to open and read a text file which is terminated by a semi colon:
Code:
private final String PATH = "file:///Sparx/mytxt.txt"; |
| All times are GMT -5. The time now is 10:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi