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

How to use
saveBytes
method
in
processing.core.PApplet

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

origin: ajavamind/Processing-Cardboard

/**
 * Saves bytes to a file to inside the sketch folder.
 * The filename can be a relative path, i.e. "poo/bytefun.txt"
 * would save to a file named "bytefun.txt" to a subfolder
 * called 'poo' inside the sketch folder. If the in-between
 * subfolders don't exist, they'll be created.
 */
public void saveBytes(String filename, byte buffer[]) {
  saveBytes(saveFile(filename), buffer);
}
origin: ajavamind/Processing-Cardboard

/**
 * Saves bytes to a specific File location specified by the user.
 */
static public void saveBytes(File file, byte buffer[]) {
  try {
    String filename = file.getAbsolutePath();
    createPath(filename);
    OutputStream output = new FileOutputStream(file);
    if (file.getName().toLowerCase().endsWith(".gz")) {
      output = new GZIPOutputStream(output);
    }
    saveBytes(output, buffer);
    output.close();
  } catch (IOException e) {
    System.err.println("error saving bytes to " + file);
    e.printStackTrace();
  }
}
origin: org.processing/core

/**
 * ( begin auto-generated from saveBytes.xml )
 *
 * Opposite of <b>loadBytes()</b>, will write an entire array of bytes to a
 * file. The data is saved in binary format. This file is saved to the
 * sketch's folder, which is opened by selecting "Show sketch folder" from
 * the "Sketch" menu.<br />
 * <br />
 * It is not possible to use saveXxxxx() functions inside a web browser
 * unless the sketch is <a
 * href="http://wiki.processing.org/w/Sign_an_Applet">signed applet</A>. To
 * save a file back to a server, see the <a
 * href="http://wiki.processing.org/w/Saving_files_to_a_web-server">save to
 * web</A> code snippet on the Processing Wiki.
 *
 * ( end auto-generated )
 *
 * @webref output:files
 * @param filename name of the file to write to
 * @param data array of bytes to be written
 * @see PApplet#loadStrings(String)
 * @see PApplet#loadBytes(String)
 * @see PApplet#saveStrings(String, String[])
 */
public void saveBytes(String filename, byte[] data) {
 saveBytes(saveFile(filename), data);
}
origin: org.processing/core

/**
 * @nowebref
 * Saves bytes to a specific File location specified by the user.
 */
static public void saveBytes(File file, byte[] data) {
 File tempFile = null;
 try {
  tempFile = createTempFile(file);
  OutputStream output = createOutput(tempFile);
  saveBytes(output, data);
  output.close();
  output = null;
  if (file.exists()) {
   if (!file.delete()) {
    System.err.println("Could not replace " + file.getAbsolutePath());
   }
  }
  if (!tempFile.renameTo(file)) {
   System.err.println("Could not rename temporary file " +
             tempFile.getAbsolutePath());
  }
 } catch (IOException e) {
  System.err.println("error saving bytes to " + file);
  if (tempFile != null) {
   tempFile.delete();
  }
  e.printStackTrace();
 }
}
processing.corePAppletsaveBytes

Javadoc

Saves bytes to a specific File location specified by the user.

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
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • BoxLayout (javax.swing)
  • Join (org.hibernate.mapping)
  • Best IntelliJ plugins
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