Package com.cedarsoft.exceptions

Examples of com.cedarsoft.exceptions.StillContainedException


  @Override
  @Nonnull
  public OutputStream openOut( @Nonnull String id ) throws FileNotFoundException {
    File file = getFile( id );
    if ( file.exists() ) {
      throw new StillContainedException( id );
    }
    return new BufferedOutputStream( new FileOutputStream( file ) );
  }
View Full Code Here


  @Nonnull
  public File addDirectory( @Nonnull String id ) throws StillContainedException {
    File dir = getDirInternal( id );
    if ( dir.exists() ) {
      throw new StillContainedException( id );
    }

    dir.mkdir();
    return dir;
  }
View Full Code Here

  @Override
  @Nonnull
  public OutputStream openOut(@Nonnull final String id) {
    byte[] stored = serialized.get(id);
    if (stored != null) {
      throw new StillContainedException(id);
    }

    return new ByteArrayOutputStream() {
      @Override
      public void close() throws IOException {
View Full Code Here

  @Override
  @Nonnull
  public OutputStream openOut( @Nonnull String id ) throws FileNotFoundException {
    File file = getFile( id );
    if ( file.exists() ) {
      throw new StillContainedException( id );
    }
    return new BufferedOutputStream( new FileOutputStream( file ) );
  }
View Full Code Here

  @Nonnull
  public File addDirectory( @Nonnull String id ) throws StillContainedException {
    File dir = getDirInternal( id );
    if ( dir.exists() ) {
      throw new StillContainedException( id );
    }

    dir.mkdir();
    return dir;
  }
View Full Code Here

  @Override
  @Nonnull
  public OutputStream openOut(@Nonnull final String id) {
    byte[] stored = serialized.get(id);
    if (stored != null) {
      throw new StillContainedException(id);
    }

    return new ByteArrayOutputStream() {
      @Override
      public void close() throws IOException {
View Full Code Here

    //todo, really necessary???
    if ( comparator != null ) {
      Collection<T> set = new TreeSet<T>( comparator );
      set.addAll( storedObjects );
      if ( storedObjects.size() != set.size() ) {
        throw new StillContainedException( "The stored objects collections contains duplicate entries" );
      }
    }

    this.storedObjects.addAll( storedObjects );
  }
View Full Code Here

    lock.writeLock().lock();
    try {
      if ( comparator != null ) {
        for ( T storedObject : storedObjects ) {
          if ( comparator.compare( storedObject, object ) == 0 ) {
            throw new StillContainedException( object );
          }
        }
      }

      storedObjects.add( object );
View Full Code Here

  @Override
  @Nonnull
  public OutputStream openOut( @Nonnull String id ) throws FileNotFoundException {
    File file = getFile( id );
    if ( file.exists() ) {
      throw new StillContainedException( id );
    }
    return new BufferedOutputStream( new FileOutputStream( file ) );
  }
View Full Code Here

  @Nonnull
  public File addDirectory( @Nonnull String id ) throws StillContainedException {
    File dir = getDirInternal( id );
    if ( dir.exists() ) {
      throw new StillContainedException( id );
    }

    dir.mkdir();
    return dir;
  }
View Full Code Here

TOP

Related Classes of com.cedarsoft.exceptions.StillContainedException

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.