@Test public void decodedLengthCalculates() { Base64.Encoder encoder = Base64.getEncoder(); String base64 = encoder.encodeToString("31337".getBytes(UTF_8)); assertThat(decodedLength(base64)).isEqualTo(5); base64 = encoder.withoutPadding().encodeToString("31337".getBytes(UTF_8)); assertThat(decodedLength(base64)).isEqualTo(5); String longerBase64 = encoder.encodeToString("313373133731337".getBytes(UTF_8)); assertThat(decodedLength(longerBase64)).isEqualTo(15); longerBase64 = encoder.withoutPadding().encodeToString("313373133731337".getBytes(UTF_8)); assertThat(decodedLength(longerBase64)).isEqualTo(15); assertThat(decodedLength("")).isZero(); }
public static int decodedLength(String secret) { checkNotNull(secret); secret = removeEnd(removeEnd(chomp(secret), "="), "="); return (secret.length() * 3) / 4; }
Secret { public static int decodedLength(String secret) { checkNotNull(secret); secret = removeEnd(removeEnd(chomp(secret), "="), "="); return (secret.length() * 3) / 4; } }
Secret { public static int decodedLength(String secret) { checkNotNull(secret); secret = removeEnd(removeEnd(chomp(secret), "="), "="); return (secret.length() * 3) / 4; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); }
Secret { public static int decodedLength(String secret) { checkNotNull(secret); secret = removeEnd(removeEnd(chomp(secret), "="), "="); return (secret.length() * 3) / 4; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); long getId(); String getName(); String getDisplayName(); String getDescription(); String getSecret(); String getChecksum(); ApiDate getCreatedAt(); String getCreatedBy(); ApiDate getUpdatedAt(); String getUpdatedBy(); ImmutableMap<String, String> getMetadata(); Optional<String> getType(); ImmutableMap<String, String> getGenerationOptions(); long getExpiry(); Optional<Long> getVersion(); Optional<ApiDate> getContentCreatedAt(); String getContentCreatedBy(); static int decodedLength(String secret); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
Secret { public static int decodedLength(String secret) { checkNotNull(secret); secret = removeEnd(removeEnd(chomp(secret), "="), "="); return (secret.length() * 3) / 4; } Secret(long id,
                String name,
                @Nullable String description,
                LazyString encryptedSecret,
                String checksum,
                ApiDate createdAt,
                @Nullable String createdBy,
                ApiDate updatedAt,
                @Nullable String updatedBy,
                @Nullable Map<String, String> metadata,
                @Nullable String type,
                @Nullable Map<String, String> generationOptions,
                long expiry,
                @Nullable Long version,
                @Nullable ApiDate contentCreatedAt,
                @Nullable String contentCreatedBy); long getId(); String getName(); String getDisplayName(); String getDescription(); String getSecret(); String getChecksum(); ApiDate getCreatedAt(); String getCreatedBy(); ApiDate getUpdatedAt(); String getUpdatedBy(); ImmutableMap<String, String> getMetadata(); Optional<String> getType(); ImmutableMap<String, String> getGenerationOptions(); long getExpiry(); Optional<Long> getVersion(); Optional<ApiDate> getContentCreatedAt(); String getContentCreatedBy(); static int decodedLength(String secret); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }