Package com.google.common.io
Class BaseEncoding.StandardBaseEncoding
- java.lang.Object
-
- com.google.common.io.BaseEncoding
-
- com.google.common.io.BaseEncoding.StandardBaseEncoding
-
- Direct Known Subclasses:
BaseEncoding.Base16Encoding
,BaseEncoding.Base64Encoding
- Enclosing class:
- BaseEncoding
static class BaseEncoding.StandardBaseEncoding extends BaseEncoding
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.io.BaseEncoding
BaseEncoding.Base16Encoding, BaseEncoding.Base64Encoding, BaseEncoding.DecodingException, BaseEncoding.SeparatedBaseEncoding, BaseEncoding.StandardBaseEncoding
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BaseEncoding.Alphabet
alphabet
private BaseEncoding
lowerCase
(package private) java.lang.Character
paddingChar
private BaseEncoding
upperCase
-
Constructor Summary
Constructors Constructor Description StandardBaseEncoding(BaseEncoding.Alphabet alphabet, java.lang.Character paddingChar)
StandardBaseEncoding(java.lang.String name, java.lang.String alphabetChars, java.lang.Character paddingChar)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDecode(java.lang.CharSequence chars)
Determines whether the specified character sequence is a valid encoded string according to this encoding.(package private) int
decodeTo(byte[] target, java.lang.CharSequence chars)
java.io.InputStream
decodingStream(java.io.Reader reader)
Returns anInputStream
that decodes base-encoded input from the specifiedReader
.(package private) void
encodeChunkTo(java.lang.Appendable target, byte[] bytes, int off, int len)
(package private) void
encodeTo(java.lang.Appendable target, byte[] bytes, int off, int len)
java.io.OutputStream
encodingStream(java.io.Writer out)
Returns anOutputStream
that encodes bytes using this encoding into the specifiedWriter
.boolean
equals(java.lang.Object other)
int
hashCode()
BaseEncoding
lowerCase()
Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with lowercase letters.(package private) int
maxDecodedSize(int chars)
(package private) int
maxEncodedSize(int bytes)
(package private) BaseEncoding
newInstance(BaseEncoding.Alphabet alphabet, java.lang.Character paddingChar)
BaseEncoding
omitPadding()
Returns an encoding that behaves equivalently to this encoding, but omits any padding characters as specified by RFC 4648 section 3.2, Padding of Encoded Data.(package private) CharMatcher
padding()
java.lang.String
toString()
BaseEncoding
upperCase()
Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with uppercase letters.BaseEncoding
withPadChar(char padChar)
Returns an encoding that behaves equivalently to this encoding, but uses an alternate character for padding.BaseEncoding
withSeparator(java.lang.String separator, int afterEveryChars)
Returns an encoding that behaves equivalently to this encoding, but adds a separator string after everyn
characters.-
Methods inherited from class com.google.common.io.BaseEncoding
base16, base32, base32Hex, base64, base64Url, decode, decodeChecked, decodingSource, encode, encode, encodingSink, ignoringReader, separatingAppendable, separatingWriter
-
-
-
-
Field Detail
-
alphabet
final BaseEncoding.Alphabet alphabet
-
paddingChar
@Nullable final java.lang.Character paddingChar
-
upperCase
private transient BaseEncoding upperCase
-
lowerCase
private transient BaseEncoding lowerCase
-
-
Constructor Detail
-
StandardBaseEncoding
StandardBaseEncoding(java.lang.String name, java.lang.String alphabetChars, @Nullable java.lang.Character paddingChar)
-
StandardBaseEncoding
StandardBaseEncoding(BaseEncoding.Alphabet alphabet, @Nullable java.lang.Character paddingChar)
-
-
Method Detail
-
padding
CharMatcher padding()
- Specified by:
padding
in classBaseEncoding
-
maxEncodedSize
int maxEncodedSize(int bytes)
- Specified by:
maxEncodedSize
in classBaseEncoding
-
encodingStream
@GwtIncompatible public java.io.OutputStream encodingStream(java.io.Writer out)
Description copied from class:BaseEncoding
Returns anOutputStream
that encodes bytes using this encoding into the specifiedWriter
. When the returnedOutputStream
is closed, so is the backingWriter
.- Specified by:
encodingStream
in classBaseEncoding
-
encodeTo
void encodeTo(java.lang.Appendable target, byte[] bytes, int off, int len) throws java.io.IOException
- Specified by:
encodeTo
in classBaseEncoding
- Throws:
java.io.IOException
-
encodeChunkTo
void encodeChunkTo(java.lang.Appendable target, byte[] bytes, int off, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
maxDecodedSize
int maxDecodedSize(int chars)
- Specified by:
maxDecodedSize
in classBaseEncoding
-
canDecode
public boolean canDecode(java.lang.CharSequence chars)
Description copied from class:BaseEncoding
Determines whether the specified character sequence is a valid encoded string according to this encoding.- Specified by:
canDecode
in classBaseEncoding
-
decodeTo
int decodeTo(byte[] target, java.lang.CharSequence chars) throws BaseEncoding.DecodingException
- Specified by:
decodeTo
in classBaseEncoding
- Throws:
BaseEncoding.DecodingException
-
decodingStream
@GwtIncompatible public java.io.InputStream decodingStream(java.io.Reader reader)
Description copied from class:BaseEncoding
Returns anInputStream
that decodes base-encoded input from the specifiedReader
. The returned stream throws aBaseEncoding.DecodingException
upon decoding-specific errors.- Specified by:
decodingStream
in classBaseEncoding
-
omitPadding
public BaseEncoding omitPadding()
Description copied from class:BaseEncoding
Returns an encoding that behaves equivalently to this encoding, but omits any padding characters as specified by RFC 4648 section 3.2, Padding of Encoded Data.- Specified by:
omitPadding
in classBaseEncoding
-
withPadChar
public BaseEncoding withPadChar(char padChar)
Description copied from class:BaseEncoding
Returns an encoding that behaves equivalently to this encoding, but uses an alternate character for padding.- Specified by:
withPadChar
in classBaseEncoding
-
withSeparator
public BaseEncoding withSeparator(java.lang.String separator, int afterEveryChars)
Description copied from class:BaseEncoding
Returns an encoding that behaves equivalently to this encoding, but adds a separator string after everyn
characters. Any occurrences of any characters that occur in the separator are skipped over in decoding.- Specified by:
withSeparator
in classBaseEncoding
-
upperCase
public BaseEncoding upperCase()
Description copied from class:BaseEncoding
Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with uppercase letters. Padding and separator characters remain in their original case.- Specified by:
upperCase
in classBaseEncoding
-
lowerCase
public BaseEncoding lowerCase()
Description copied from class:BaseEncoding
Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with lowercase letters. Padding and separator characters remain in their original case.- Specified by:
lowerCase
in classBaseEncoding
-
newInstance
BaseEncoding newInstance(BaseEncoding.Alphabet alphabet, @Nullable java.lang.Character paddingChar)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-