file.java :  » Java-2D » polhemthegame » loader » Java Open Source

Java Open Source » Java 2D » polhemthegame 
polhemthegame » loader » file.java
package loader;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class file
{
  BufferedReader input;

  public file( final String[] dirs, final String file ) throws FileNotFoundException
  {
    input = new BufferedReader( new FileReader( relative_path( dirs, file ) ) );
  }

  public file( final String file ) throws FileNotFoundException
  {
    input = new BufferedReader( new FileReader( file ) );
  }

  public void close() throws IOException
  {
    input.close();
  }

  public String read_line() throws IOException
  {
    return input.readLine();
  }

  public static String relative_path( final String[] dirs )
  {
    return _path( dirs );
  }

  public static String relative_path( final String[] dirs, final String file )
  {
    return _path( dirs ) + file;
  }

  private static String _path( final String[] paths )
  {
    String res = "";
    for ( final String s : paths ) {
      res += s + File.separator;
    }

    return res;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.