deepdiff.core.DiffUnit Maven / Gradle / Ivy
/*
* Copyright 2011 DeepDiff Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package deepdiff.core;
import java.io.IOException;
import java.io.InputStream;
/**
* A unit of data that can be compared and broken down into individual
* differences. These differences are {@link
* deepdiff.core.DiffPoint}s.
*/
public interface DiffUnit {
/**
* Returns whether the entity on the left exists
*
* @return whether the entity on the left exists
*/
boolean leftExists();
/**
* Returns whether the entity on the right exists
*
* @return whether the entity on the right exists
*/
boolean rightExists();
/**
* Returns whether the entity on the left can contain children of some sort
*
* @return whether the entity on the left can contain children of some sort
*/
boolean leftIsDir();
/**
* Returns whether the entity on the right can contain children of some sort
*
* @return whether the entity on the right can contain children of some sort
*/
boolean rightIsDir();
/**
* Returns an {@link InputStream} for content of the entity on the left
*
* @return an {@link InputStream} for content of the entity on the left
*
* @throws IOException if there was an error assembling the {@link
* InputStream}
*/
InputStream getLeftInputStream() throws IOException;
/**
* Returns an {@link InputStream} for content of the entity on the right
*
* @return an {@link InputStream} for content of the entity on the right
*
* @throws IOException if there was an error assembling the {@link
* InputStream}
*/
InputStream getRightInputStream() throws IOException;
/**
* Returns the path of the unit, including information about the scope. For
* example, if the unit was a file embedded within a Zip file, it could
* include that path to the Zip file, as well as the path within the Zip
* file.
*
* @return the path of the unit, including information about the scope
*/
String getScopedPath();
}