Package org.encog.ml.data.buffer

Examples of org.encog.ml.data.buffer.BufferedDataError


    if (this.readZipFile != null) {
      try {
        this.readZipFile.close();
        this.readZipFile = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }

    if (this.zos != null) {
      try {
        final ZipEntry theEntry
          = new ZipEntry("xl/worksheets/sheet1.xml");
        this.xmlOut.endTag();
        this.xmlOut.addAttribute("left", "0.7");
        this.xmlOut.addAttribute("right", "0.7");
        this.xmlOut.addAttribute("top", "0.75");
        this.xmlOut.addAttribute("bottom", "0.75");
        this.xmlOut.addAttribute("header", "0.3");
        this.xmlOut.addAttribute("footer", "0.3");

        this.xmlOut.beginTag("pageMargins");
        this.xmlOut.endTag();
        this.xmlOut.endTag();
        this.xmlOut.endDocument();

        final byte[] b = this.buffer.toByteArray();
        theEntry.setSize(b.length);
        theEntry.setCompressedSize(-1);
        theEntry.setMethod(ZipEntry.DEFLATED);
        this.zos.putNextEntry(theEntry);
        this.zos.write(b);
        this.zos.closeEntry();
        this.zos.close();
        this.zos = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }

    if (this.fos != null) {
      try {
        this.fos.close();
        this.fos = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }
  }
View Full Code Here


      }

      if (this.entry == null) {
        this.readZipFile.close();
        this.readZipFile = null;
        throw new BufferedDataError("Could not find worksheet.");
      }

      final InputStream is = this.readZipFile.getInputStream(this.entry);
      this.xmlIn = new ReadXML(is);

    } catch (final ZipException e) {
      throw new BufferedDataError("Not a valid Excel file.");
    } catch (final IOException e) {
      throw new BufferedDataError(e);
    }
  }
View Full Code Here

      this.xmlOut.endTag();
      this.row = 1;
      this.xmlOut.beginTag("sheetData");

    } catch (final IOException ex) {
      throw new BufferedDataError(ex);
    }
  }
View Full Code Here

   */
  public CSVDataCODEC(final File theFile, final CSVFormat theFormat,
      final boolean theHeaders, final int theInputCount,
      final int theIdealCount, final boolean theExpectSignificance) {
    if (this.inputCount != 0) {
      throw new BufferedDataError(
          "To export CSV, you must use the CSVDataCODEC "
              + "constructor that does not specify input or ideal sizes.");
    }
    this.file = theFile;
    this.format = theFormat;
View Full Code Here

   * Prepare to read from the CSV file.
   */
  @Override
  public final void prepareRead() {
    if (this.inputCount == 0) {
      throw new BufferedDataError("To import CSV, you must use the "
          + "CSVDataCODEC constructor that specifies input and "
          + "ideal sizes.");
    }
    this.readCSV = new ReadCSV(this.file.toString(), this.headers,
        this.format);
View Full Code Here

    try {
      this.inputCount = inputSize;
      this.idealCount = idealSize;
      this.output = new PrintStream(new FileOutputStream(this.file));
    } catch (final IOException ex) {
      throw new BufferedDataError(ex);
    }
  }
View Full Code Here

    if (this.readZipFile != null) {
      try {
        this.readZipFile.close();
        this.readZipFile = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }

    if (this.zos != null) {
      try {
        final ZipEntry theEntry
          = new ZipEntry("xl/worksheets/sheet1.xml");
        this.xmlOut.endTag();
        this.xmlOut.addAttribute("left", "0.7");
        this.xmlOut.addAttribute("right", "0.7");
        this.xmlOut.addAttribute("top", "0.75");
        this.xmlOut.addAttribute("bottom", "0.75");
        this.xmlOut.addAttribute("header", "0.3");
        this.xmlOut.addAttribute("footer", "0.3");

        this.xmlOut.beginTag("pageMargins");
        this.xmlOut.endTag();
        this.xmlOut.endTag();
        this.xmlOut.endDocument();

        final byte[] b = this.buffer.toByteArray();
        theEntry.setSize(b.length);
        theEntry.setCompressedSize(-1);
        theEntry.setMethod(ZipEntry.DEFLATED);
        this.zos.putNextEntry(theEntry);
        this.zos.write(b);
        this.zos.closeEntry();
        this.zos.close();
        this.zos = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }

    if (this.fos != null) {
      try {
        this.fos.close();
        this.fos = null;
      } catch (final IOException e) {
        throw new BufferedDataError(e);
      }
    }
  }
View Full Code Here

      }

      if (this.entry == null) {
        this.readZipFile.close();
        this.readZipFile = null;
        throw new BufferedDataError("Could not find worksheet.");
      }

      final InputStream is = this.readZipFile.getInputStream(this.entry);
      this.xmlIn = new ReadXML(is);

    } catch (final ZipException e) {
      throw new BufferedDataError("Not a valid Excel file.");
    } catch (final IOException e) {
      throw new BufferedDataError(e);
    }
  }
View Full Code Here

      this.xmlOut.endTag();
      this.row = 1;
      this.xmlOut.beginTag("sheetData");

    } catch (final IOException ex) {
      throw new BufferedDataError(ex);
    } finally {
      if( zis!=null ) {
        try {
          zis.close();
        } catch (IOException e) {
View Full Code Here

   * Prepare to read from the CSV file.
   */
  @Override
  public void prepareRead() {
    if (this.inputCount == 0) {
      throw new BufferedDataError("To import CSV, you must use the "
          + "CSVDataCODEC constructor that specifies input and "
          + "ideal sizes.");
    }
    this.readCSV = new ReadCSV(this.file.toString(), this.headers,
        this.format);
View Full Code Here

TOP

Related Classes of org.encog.ml.data.buffer.BufferedDataError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.