Tabnine Logo
PApplet.createInput
Code IndexAdd Tabnine to your IDE (free)

How to use
createInput
method
in
processing.core.PApplet

Best Java code snippets using processing.core.PApplet.createInput (Showing top 20 results out of 315)

origin: ajavamind/Processing-Cardboard

public XML loadXML(String filename, String options) {
  try {
    return new XML(createInput(filename), options);
  } catch (Exception e) {
    e.printStackTrace();
    return null;
  }
}
origin: ajavamind/Processing-Cardboard

static public String[] loadStrings(File file) {
  InputStream is = createInput(file);
  if (is != null) return loadStrings(is);
  return null;
}
origin: ajavamind/Processing-Cardboard

public byte[] loadBytes(String filename) {
  InputStream is = createInput(filename);
  if (is != null) return loadBytes(is);
  System.err.println("The file \"" + filename + "\" " +
      "is missing or inaccessible, make sure " +
      "the URL is valid or that the file has been " +
      "added to your sketch and is readable.");
  return null;
}
origin: ajavamind/Processing-Cardboard

static public byte[] loadBytes(File file) {
  InputStream is = createInput(file);
  return loadBytes(is);
}
origin: org.processing/core

/**
 * @nowebref
 */
static public String[] loadStrings(File file) {
 if (!file.exists()) {
  System.err.println(file + " does not exist, loadStrings() will return null");
  return null;
 }
 InputStream is = createInput(file);
 if (is != null) {
  String[] outgoing = loadStrings(is);
  try {
   is.close();
  } catch (IOException e) {
   e.printStackTrace();
  }
  return outgoing;
 }
 return null;
}
origin: ajavamind/Processing-Cardboard

/**
 * I want to read lines from a file. I have RSI from typing these
 * eight lines of code so many times.
 */
public BufferedReader createReader(String filename) {
  try {
    InputStream is = createInput(filename);
    if (is == null) {
      System.err.println(filename + " does not exist or could not be read");
      return null;
    }
    return createReader(is);
  } catch (Exception e) {
    if (filename == null) {
      System.err.println("Filename passed to reader() was null");
    } else {
      System.err.println("Couldn't create a reader for " + filename);
    }
  }
  return null;
}
origin: ajavamind/Processing-Cardboard

/**
 * Load data from a file and shove it into a String array.
 * <p/>
 * Exceptions are handled internally, when an error, occurs, an
 * exception is printed to the console and 'null' is returned,
 * but the program continues running. This is a tradeoff between
 * 1) showing the user that there was a problem but 2) not requiring
 * that all i/o code is contained in try/catch blocks, for the sake
 * of new users (or people who are just trying to get things done
 * in a "scripting" fashion. If you want to handle exceptions,
 * use Java methods for I/O.
 */
public String[] loadStrings(String filename) {
  InputStream is = createInput(filename);
  if (is != null) return loadStrings(is);
  System.err.println("The file \"" + filename + "\" " +
      "is missing or inaccessible, make sure " +
      "the URL is valid or that the file has been " +
      "added to your sketch and is readable.");
  return null;
}
origin: ajavamind/Processing-Cardboard

  public PImage loadImage(String filename) {
//    return loadImage(filename, null);
    InputStream stream = createInput(filename);
    if (stream == null) {
      System.err.println("Could not find the image " + filename + ".");
      return null;
    }
//    long t = System.currentTimeMillis();
    Bitmap bitmap = null;
    try {
      bitmap = BitmapFactory.decodeStream(stream);
    } finally {
      try {
        stream.close();
        stream = null;
      } catch (IOException e) {
      }
    }
//    int much = (int) (System.currentTimeMillis() - t);
//    println("loadImage(" + filename + ") was " + nfc(much));
    PImage image = new PImage(bitmap);
    image.parent = this;
//    if (params != null) {
//      image.setParams(g, params);
//    }
    return image;
  }

origin: org.processing/core

/**
 * ( begin auto-generated from createReader.xml )
 *
 * Creates a <b>BufferedReader</b> object that can be used to read files
 * line-by-line as individual <b>String</b> objects. This is the complement
 * to the <b>createWriter()</b> function.
 * <br/> <br/>
 * Starting with Processing release 0134, all files loaded and saved by the
 * Processing API use UTF-8 encoding. In previous releases, the default
 * encoding for your platform was used, which causes problems when files
 * are moved to other platforms.
 *
 * ( end auto-generated )
 * @webref input:files
 * @param filename name of the file to be opened
 * @see BufferedReader
 * @see PApplet#createWriter(String)
 * @see PrintWriter
 */
public BufferedReader createReader(String filename) {
 InputStream is = createInput(filename);
 if (is == null) {
  System.err.println("The file \"" + filename + "\" " +
           "is missing or inaccessible, make sure " +
           "the URL is valid or that the file has been " +
           "added to your sketch and is readable.");
  return null;
 }
 return createReader(is);
}
origin: mirador/mirador

public Interface(PApplet app, String cssfile) {
 this.app = app;
 
 root = new Widget(this);
 selected = null;
 drawnWidgets = new ArrayList<Widget>();
 state = INIT;
 
 viewport = currentClip = new ClipRect(0, 0, app.width, app.height);
 clipStack = new Stack<ClipRect>();    
 
 imageCache = new HashMap<String, PImage>();
 fontCache = new HashMap<String, PFont>();
 shapeCache = new HashMap<String, PShape>();
 
 if (cssfile != null && !cssfile.equals("")) {
  style = new Style(app.createInput(cssfile));
 }
 
 bckColor = 0xFFFFFFFF;
 enabled = true;
}  

origin: ajavamind/Processing-Cardboard

public Table loadTable(String filename, String options) {
  try {
    String ext = checkExtension(filename);
    if (ext != null) {
      if (ext.equals("csv") || ext.equals("tsv")) {
        if (options == null) {
          options = ext;
        } else {
          options = ext + "," + options;
        }
      }
    }
    return new Table(createInput(filename), options);
  } catch (IOException e) {
    e.printStackTrace();
    return null;
  }
}
origin: ajavamind/Processing-Cardboard

public PFont loadFont(String filename) {
  try {
    InputStream input = createInput(filename);
    return new PFont(input);
  } catch (Exception e) {
    die("Could not load font " + filename + ". " +
        "Make sure that the font has been copied " +
        "to the data folder of your sketch.", e);
  }
  return null;
}
origin: org.processing/core

protected PFont createFont(String name, float size,
            boolean smooth, char[] charset) {
 String lowerName = name.toLowerCase();
 Font baseFont = null;
 try {
  InputStream stream = null;
  if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) {
   stream = parent.createInput(name);
   if (stream == null) {
    System.err.println("The font \"" + name + "\" " +
                "is missing or inaccessible, make sure " +
                "the URL is valid or that the file has been " +
                "added to your sketch and is readable.");
    return null;
   }
   baseFont = Font.createFont(Font.TRUETYPE_FONT, parent.createInput(name));
  } else {
   baseFont = PFont.findFont(name);
  }
  return new PFont(baseFont.deriveFont(size * parent.pixelDensity),
           smooth, charset, stream != null,
           parent.pixelDensity);
 } catch (Exception e) {
  System.err.println("Problem with createFont(\"" + name + "\")");
  e.printStackTrace();
  return null;
 }
}
origin: ajavamind/Processing-Cardboard

/**
 * version that uses a File object; future releases (or data types)
 * may include additional optimizations here
 *
 * @nowebref
 */
public Table(File file, String options) throws IOException {
 // uses createInput() to handle .gz (and eventually .bz2) files
 init();
 parse(PApplet.createInput(file),
    extensionOptions(true, file.getName(), options));
}
origin: org.processing/core

/**
 * version that uses a File object; future releases (or data types)
 * may include additional optimizations here
 *
 * @nowebref
 */
public Table(File file, String options) throws IOException {
 // uses createInput() to handle .gz (and eventually .bz2) files
 init();
 parse(PApplet.createInput(file),
    extensionOptions(true, file.getName(), options));
}
origin: org.processing/core

InputStream stream = createInput(filename);
if (stream == null) {
 System.err.println("The image " + filename + " could not be found.");
origin: org.processing/core

InputStream input = createInput(filename);
return new PFont(input);
origin: ajavamind/Processing-Cardboard

@Override
public PShape loadShape(String filename) {
 String extension = PApplet.getExtension(filename);
 PShapeSVG svg = null;
 if (extension.equals("svg")) {
  svg = new PShapeSVG(parent.loadXML(filename));
 } else if (extension.equals("svgz")) {
  try {
   InputStream input = new GZIPInputStream(parent.createInput(filename));
   XML xml = new XML(input);
   svg = new PShapeSVG(xml);
  } catch (Exception e) {
   e.printStackTrace();
  }
 } else {
  PGraphics.showWarning("Unsupported format");
 }
 return svg;
}
origin: org.processing/core

 if (opt.startsWith("dictionary=")) {
  dictionary = loadTable(opt.substring(opt.indexOf('=') + 1), "tsv");
  return dictionary.typedParse(createInput(filename), optionStr);
InputStream input = createInput(filename);
if (input == null) {
 System.err.println(filename + " does not exist or could not be read");
origin: org.processing/core

font = Font.loadFont(parent.createInput(filename), size);
processing.corePAppletcreateInput

Popular methods of PApplet

  • constrain
  • createGraphics
    Create an offscreen graphics surface for drawing, in this case for a renderer that writes to a file
  • loadStrings
    ( begin auto-generated from loadStrings.xml ) Reads the contents of a file or url and creates a Stri
  • saveStrings
    ( begin auto-generated from saveStrings.xml ) Writes an array of strings to a file, one line per str
  • abs
  • createImage
    ( begin auto-generated from createImage.xml ) Creates a new PImage (the datatype for storing images)
  • createShape
  • createWriter
    ( begin auto-generated from createWriter.xml ) Creates a new file in the sketch folder, and a PrintW
  • loadImage
  • main
    main() method for running this class from the command line. Usage: PApplet [options] [s
  • max
  • parseInt
  • max,
  • parseInt,
  • random,
  • round,
  • split,
  • sqrt,
  • unhex,
  • arrayCopy,
  • ceil,
  • checkExtension

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • Menu (java.awt)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now