public OFile create(final String iType, final String iFileName, final String iOpenMode)
      throws IOException {
    final Class<? extends OFile> fileClass = registry.get(iType);

    if (fileClass == null)
      throw new OConfigurationException("File type '" + iType + "' is not configured");

    try {
      final OFile f = fileClass.newInstance();
      f.init(iFileName, iOpenMode);
      return f;
    } catch (final Exception e) {
      throw new OConfigurationException("Cannot create file of type '" + iType + "'", e);
    }
  }
Beispiel #2
0
  @Override
  public void close() throws IOException {
    if (channel != null) setSoftlyClosed(true);

    if (internalWriteBuffer != null) internalWriteBuffer = null;

    super.close();
  }
Beispiel #3
0
  @Override
  public void changeSize(final int iSize) {
    super.changeSize(iSize);
    try {
      channel.force(false);
      channel.close();
      openChannel(iSize);

    } catch (IOException e) {
      OLogManager.instance()
          .error(
              this,
              "Error on changing the file size to " + iSize + " bytes",
              e,
              OIOException.class);
    }
  }