Package org.scijava.io.location
Class BytesLocation
- java.lang.Object
-
- org.scijava.io.location.AbstractLocation
-
- org.scijava.io.location.BytesLocation
-
- All Implemented Interfaces:
Location
public class BytesLocation extends AbstractLocation
- Author:
- Curtis Rueden, Gabriel Einsdorf
-
-
Constructor Summary
Constructors Constructor Description BytesLocation(byte[] bytes)Creates aBytesLocationbacked by aByteArrayByteBankwhich wraps the specified array.BytesLocation(byte[] bytes, int offset, int length)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity and the provided data.BytesLocation(byte[] bytes, int offset, int length, String name)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity and the provided data.BytesLocation(byte[] bytes, String name)Creates aBytesLocationbacked by aByteArrayByteBankwhich wraps the specified array.BytesLocation(int initialCapacity)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity, but with a reported size of 0.BytesLocation(int initialCapacity, String name)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity, but with a reported size of 0.BytesLocation(ByteBank bytes)Creates aBytesLocationbacked by the specifiedByteBank.BytesLocation(ByteBank bytes, String name)Creates aBytesLocationbacked by the specifiedByteBank.BytesLocation(ByteArray bytes)BytesLocation(ByteArray bytes, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)ByteBankgetByteBank()Gets the backingByteBank.StringgetName()Gets a (typically short) name expressing this location.inthashCode()-
Methods inherited from class org.scijava.io.location.AbstractLocation
toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.io.location.Location
defaultName, getURI
-
-
-
-
Constructor Detail
-
BytesLocation
public BytesLocation(ByteBank bytes)
Creates aBytesLocationbacked by the specifiedByteBank.
-
BytesLocation
public BytesLocation(ByteBank bytes, String name)
Creates aBytesLocationbacked by the specifiedByteBank.
-
BytesLocation
public BytesLocation(int initialCapacity)
Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity, but with a reported size of 0. This method can be used to avoid needing to grow the underlyingByteBank.
-
BytesLocation
public BytesLocation(int initialCapacity, String name)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity, but with a reported size of 0. This method can be used to avoid needing to grow the underlyingByteBank.- Parameters:
name- the name of thisLocation
-
BytesLocation
public BytesLocation(ByteArray bytes)
-
BytesLocation
public BytesLocation(ByteArray bytes, String name)
- Parameters:
name- the name of this Location.
-
BytesLocation
public BytesLocation(byte[] bytes)
Creates aBytesLocationbacked by aByteArrayByteBankwhich wraps the specified array.- Parameters:
bytes- the array to wrap
-
BytesLocation
public BytesLocation(byte[] bytes, String name)Creates aBytesLocationbacked by aByteArrayByteBankwhich wraps the specified array.- Parameters:
bytes- the array to wrapname- the name of this Location.
-
BytesLocation
public BytesLocation(byte[] bytes, int offset, int length)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity and the provided data.- Parameters:
bytes- the bytes to copy into the newBytesLocationoffset- the offset in the bytes array to start copying fromlength- the number of bytes to copy, starting from the offset
-
BytesLocation
public BytesLocation(byte[] bytes, int offset, int length, String name)Creates aBytesLocationbacked by aByteArrayByteBankwith the specified initial capacity and the provided data.- Parameters:
bytes- the bytes to copy into the newBytesLocationoffset- the offset in the bytes array to start copying fromlength- the number of bytes to copy, starting from the offsetname- the name of this Location.
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:LocationGets a (typically short) name expressing this location. This string is not intended to unambiguously identify the location, but rather act as a friendly, human-readable name. The precise behavior will depend on the implementation, but as an example, a file-based location could return the name of the associated file without its full path.- Returns:
- The name, or an empty string if no name is available.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractLocation
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractLocation
-
-