Package ucar.unidata.util
Class ByteString.Concrete
java.lang.Object
ucar.unidata.util.ByteString
ucar.unidata.util.ByteString.Concrete
- All Implemented Interfaces:
Serializable
,Comparable
- Direct Known Subclasses:
ByteString.TrSubString
- Enclosing class:
ByteString
Class Concrete
- Version:
- %I%, %G%
- Author:
- Unidata development team
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ucar.unidata.util.ByteString
ByteString.Concrete, ByteString.Empty, ByteString.SubString, ByteString.TrSubString
-
Field Summary
FieldsFields inherited from class ucar.unidata.util.ByteString
nada
-
Constructor Summary
ConstructorsModifierConstructorDescriptionConcrete
(byte[] ba, boolean share) Constructs a newByteString
initialized to contain the same sequence of bytes as the contained in the byte array argument.Construct a ByteString by narrowing a String.Concrete
(ByteString bs) Copy constuctor.protected
Concrete
(ByteString.Concrete bs, boolean share) Copy constuctor.Concrete
(ByteString bs, int length) Copy constuctor which trims input to length.Concrete
(ByteString bs, int origin, int length) Copy constuctor which trims input to [origin, origin + length). -
Method Summary
Modifier and TypeMethodDescriptionbyte
byteAt
(int ii) _more_byte[]
copyBytes
(int srcpos, byte[] dst, int dstpos, int nbytes) _more_int
_more_subByteString
(int beginIndex, int length) _more_substring
(int beginIndex) _more_byte[]
toArray()
_more_
-
Field Details
-
ba_
protected final byte[] ba_Storage for the data
-
-
Constructor Details
-
Concrete
public Concrete(byte[] ba, boolean share) Constructs a newByteString
initialized to contain the same sequence of bytes as the contained in the byte array argument. Ifshare
istrue
then the byte array argument is used as backing storage. Caution: in this case, subsequent modification of the byte array affects the newly created ByteString. Otherwise, the contents of the byte array are copied and subsequent modification of the byte array does not affect the newly created ByteString.- Parameters:
ba
- byte array which initializes contents of thisshare
- boolean, if false, make a private copy of ba
-
Concrete
Copy constuctor. Never shares storage with bs.- Parameters:
bs
-
-
Concrete
Copy constuctor.- Parameters:
bs
-share
-
-
Concrete
Copy constuctor which trims input to length. Used by subByteString and substring. Never shares storage with bs.- Parameters:
bs
-length
-
-
Concrete
Copy constuctor which trims input to [origin, origin + length). Used by subByteString and substring. Never shares storage with bs.- Parameters:
bs
-origin
-length
-
-
Concrete
Construct a ByteString by narrowing a String.- Parameters:
str
-
-
-
Method Details
-
getLength
public int getLength()_more_- Specified by:
getLength
in classByteString
- Returns:
- _more_
-
byteAt
public byte byteAt(int ii) _more_- Specified by:
byteAt
in classByteString
- Parameters:
ii
-- Returns:
- _more_
-
copyBytes
public byte[] copyBytes(int srcpos, byte[] dst, int dstpos, int nbytes) _more_- Overrides:
copyBytes
in classByteString
- Parameters:
srcpos
-dst
-dstpos
-nbytes
-- Returns:
- _more_
-
toArray
public byte[] toArray()_more_- Overrides:
toArray
in classByteString
- Returns:
- _more_
-
subByteString
_more_- Overrides:
subByteString
in classByteString
- Parameters:
beginIndex
-length
-- Returns:
- _more_
-
substring
_more_- Overrides:
substring
in classByteString
- Parameters:
beginIndex
-- Returns:
- _more_
- See Also:
-