Go to Post I'll do my best, but I'm this --><-- close to telling our drivers they're NASCAR styling it this season..."Sorry boys and girls, left turns only!" - Mr. Lim [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-10-2012, 22:54
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
WPILIBJ java.io.File equivalent

What class in the WPILIBJ would provide similar functionality as the java.io.File class does in Java SE? I can't seem to find anything appropriate.

Also, how would I be able to read a .TXT file via ftp to the robot? Ideally I'd like to have a method that converts the contents of the file to a string. I have done this in SE with Scanner in Java SE, how would I do it with FileInputStream or something of the like?

Example of what I'd like to do in Java SE :

Code:
public static String getStringFromFile(File file) throws FileNotFoundException {
    if (!file.exists()) {
        throw new FileNotFoundException();
    }
    try {
        return new Scanner(file).useDelimiter("\\A").next().trim();
    } catch (java.util.NoSuchElementException e) {
        return "";
    }
}
__________________
All opinions are my own.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-10-2012, 23:30
krieck's Avatar
krieck krieck is online now
Registered User
AKA: Keith
FRC #2846 (Firebears)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 49
krieck is an unknown quantity at this point
Re: WPILIBJ java.io.File equivalent

You can read and write files on the cRIO using the com.sun.squawk.microedition.io.FileConnection class. FileConnections are opened using the javax.microedition.io.Connector class.

And yes, you should be able to read and write text files through FTP.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-10-2012, 15:12
rrossbach rrossbach is offline
Registered User
AKA: Ron R
FRC #2607 (RoboVikings)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Warrington PA
Posts: 90
rrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to behold
Re: WPILIBJ java.io.File equivalent

Take a look at these threads for some pointers:

http://www.chiefdelphi.com/forums/sh...217#post924217

http://www.chiefdelphi.com/forums/sh...440#post949440

- Ron
Team #2607 controls mentor
__________________

FIRST Mid-Atlantic Volunteer
FRC Team #2607 Mentor
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi