Package util.io

Examples of util.io.FileFormatException


    }

    String[] tokens;
    while ((tokens = reader.readNext()) != null) {
      if (tokens.length < 4) {
        throw new FileFormatException("Syntax error in mirror file line " + lineCount + ": column count is '" + tokens.length + " < 4' : " + tokens[0]);
      }

      String country = null, timezone = null, id = null, name = null, copyright = null, webpage = null, iconUrl = null, categoryStr = null, unescapedname = null;
      try {
        country = tokens[0];
View Full Code Here


    } catch (IOException exc) {
      file.delete();
      throw exc;
    } catch (FileFormatException exc) {
      file.delete();
      throw new FileFormatException("Writing file failed " + file.getAbsolutePath(), exc);
    }
  }
View Full Code Here

    boolean otherIsUpdateFile)
    throws FileFormatException
  {
    // Check the version
    if (otherIsUpdateFile && (otherFile.getVersion() <= getVersion())) {
      throw new FileFormatException("Update file must have a higher version ("
        + otherFile.getVersion() + " <= " + getVersion() + ")");
    }

    // Go through all frames in the merge the day programs
    for (int frameNr = 0; frameNr < otherFile.getProgramFrameCount(); frameNr++) {
View Full Code Here

      // Check whether there is a program that has the same ID than this one
      for (int j = i + 1; j < getProgramFrameCount(); j++) {
        ProgramFrame cmp = getProgramFrameAt(j);

        if (frame.getId() == cmp.getId()) {
          throw new FileFormatException("Program #" + i + " and program #" + j
            + " have the same ID: " + frame.getId());
        }
      }
    }
  }
View Full Code Here

  {
    InputStream gIn = IOUtilities.openSaveGZipInputStream(stream);

    int fileVersion = gIn.read();
    if (fileVersion > FILE_VERSION) {
      throw new FileFormatException("Unknown file version: " + fileVersion);
    }

    int version = gIn.read();

    gIn.close();
View Full Code Here

  {
    InputStream gIn = IOUtilities.openSaveGZipInputStream(stream);

    int fileVersion = gIn.read();
    if (fileVersion > FILE_VERSION) {
      throw new FileFormatException("Unknown file version: " + fileVersion);
    }

    mVersion = gIn.read();

    int programCount = gIn.read();
View Full Code Here

    InputStream gIn = IOUtilities.openSaveGZipInputStream(stream);
   
    // The header
    int fileVersion = gIn.read();
    if (fileVersion > FILE_VERSION) {
      throw new FileFormatException("Unknown file version: " + fileVersion);
    }
   
    int startDaysSince1970 = ((gIn.read() & 0xFF) << 16)
                           | ((gIn.read() & 0xFF) << 8)
                           (gIn.read() & 0xFF);
View Full Code Here

  private String readString(InputStream stream)
    throws IOException, FileFormatException
  {
    int len = stream.read();
    if (len == -1) {
      throw new FileFormatException("Unexpected end of stream");
    }
   
    byte[] data = IOUtilities.readBinaryData(stream, len);
    return new String(data, TEXT_CHARSET);
  }
View Full Code Here

    byte[] data;
    try {
      data = str.getBytes(TEXT_CHARSET);
    }
    catch (UnsupportedEncodingException exc) {
      throw new FileFormatException("Encoding not supported: " + TEXT_CHARSET, exc);
    }
   
    stream.write((byte) data.length);
    stream.write(data);
  }
View Full Code Here


    private void checkFormat() throws FileFormatException {
        // Check whether the field data has the right format
        if (!getType().isRightFormat(mDataFormat)) {
            throw new FileFormatException("The field '" + getType().getName()
                    + "' must have the " + ProgramFieldType.getFormatName(getType().getFormat())
                    + " but it has the " + ProgramFieldType.getFormatName(mDataFormat));
        }
    }
View Full Code Here

TOP

Related Classes of util.io.FileFormatException

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.