or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

core-message-api.mddescriptors-reflection.mdextensions.mdindex.mdjson-format.mdserialization-io.mdwell-known-types.md
tile.json

tessl/maven-com-typesafe-akka--akka-protobuf-v3_2-13

Akka Protobuf V3 is a shaded version of the Google protobuf runtime library that renames com.google.protobuf.** to akka.protobufv3.internal.** to avoid conflicts with other protobuf versions used in applications.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/com.typesafe.akka/akka-protobuf-v3_2.13@2.8.x

To install, run

npx @tessl/cli install tessl/maven-com-typesafe-akka--akka-protobuf-v3_2-13@2.8.0

index.mddocs/

Akka Protobuf V3

Akka Protobuf V3 is a shaded version of the Google protobuf runtime library that renames com.google.protobuf.** to akka.protobufv3.internal.** to avoid conflicts with other protobuf versions used in applications. This is an internal utility library used by other Akka modules that require protobuf serialization.

Package Information

  • Package Name: akka-protobuf-v3_2.13
  • Package Type: Maven
  • Language: Java (compatible with Scala)
  • Group ID: com.typesafe.akka
  • Artifact ID: akka-protobuf-v3_2.13
  • Version: 2.8.8
  • Installation: Add dependency to your build configuration (SBT, Maven, Gradle)

Core Imports

All classes are in the akka.protobufv3.internal package namespace (shaded from com.google.protobuf).

import akka.protobufv3.internal.Message;
import akka.protobufv3.internal.ByteString;
import akka.protobufv3.internal.CodedInputStream;
import akka.protobufv3.internal.CodedOutputStream;

For Scala projects:

import akka.protobufv3.internal.{Message, ByteString, CodedInputStream, CodedOutputStream}

Basic Usage

import akka.protobufv3.internal.*;

// Create a ByteString from UTF-8 text
ByteString data = ByteString.copyFromUtf8("Hello, Protocol Buffers!");

// Convert back to string
String text = data.toStringUtf8();

// Serialize ByteString to byte array
byte[] bytes = data.toByteArray();

// Create ByteString from byte array
ByteString restored = ByteString.copyFrom(bytes);

// Parse a message from bytes (example with a hypothetical UserMessage)
// UserMessage message = UserMessage.parseFrom(bytes);

Architecture

Akka Protobuf V3 provides the complete Protocol Buffers Java runtime with several key components:

  • Message System: Core interfaces and classes for protocol buffer messages (Message, MessageLite, builders)
  • Serialization: Binary I/O operations (CodedInputStream, CodedOutputStream, ByteString)
  • Reflection API: Runtime descriptors for dynamic message handling (Descriptors.*)
  • Well-Known Types: Standard protobuf types like Timestamp, Duration, Any, wrapper types
  • JSON Support: JSON format conversion utilities (JsonFormat)
  • Extension System: Support for protobuf extensions (ExtensionRegistry)
  • Text Format: Human-readable text representation (TextFormat)

All functionality is identical to the original Google protobuf-java 3.16.3 library, but with package names changed from com.google.protobuf.** to akka.protobufv3.internal.** to avoid version conflicts in the Akka ecosystem.

Capabilities

Core Message API

Core interfaces and abstract classes for protocol buffer messages, builders, and parsing. Provides the foundation for all protobuf message operations.

interface Message extends MessageLite, MessageOrBuilder {
    // Core message interface with full functionality
}

interface MessageLite {
    // Lite message interface with minimal functionality  
}

abstract class AbstractMessage implements Message {
    // Partial implementation of Message interface
}

abstract class GeneratedMessageV3 extends AbstractMessage {
    // Base class for generated protocol buffer messages
}

Core Message API

Serialization and I/O

Binary serialization, deserialization, and I/O operations for protocol buffer messages. Includes ByteString utilities and coded streams.

class ByteString {
    static ByteString copyFrom(byte[] bytes);
    static ByteString copyFromUtf8(String text);
    byte[] toByteArray();
    String toStringUtf8();
    ByteString substring(int beginIndex);
    ByteString concat(ByteString other);
}

class CodedInputStream {
    static CodedInputStream newInstance(byte[] buf);
    static CodedInputStream newInstance(InputStream input);
    // Read methods for various protobuf types
}

class CodedOutputStream {
    static CodedOutputStream newInstance(byte[] flatArray);
    static CodedOutputStream newInstance(OutputStream output);
    // Write methods for various protobuf types
}

Serialization and I/O

Descriptors and Reflection

Runtime reflection API for dynamically working with protocol buffer message types, fields, and schemas without generated code.

class Descriptors {
    static class Descriptor {
        // Describes a message type
        String getName();
        String getFullName();
        List<FieldDescriptor> getFields();
    }
    
    static class FieldDescriptor {
        // Describes a field in a message
        String getName();
        FieldType getType();
        boolean isRepeated();
    }
    
    static class FileDescriptor {
        // Describes a .proto file
        String getName();
        List<Descriptor> getMessageTypes();
    }
}

class DynamicMessage implements Message {
    // Can represent arbitrary message types given a Descriptor
    static DynamicMessage newBuilder(Descriptor type);
}

Descriptors and Reflection

Well-Known Types

Standard protocol buffer types including timestamps, durations, Any messages, and wrapper types for primitives.

class Timestamp implements Message {
    // Represents a point in time
    long getSeconds();
    int getNanos();
    static Builder newBuilder();
}

class Duration implements Message {
    // Represents a span of time
    long getSeconds();  
    int getNanos();
    static Builder newBuilder();
}

class Any implements Message {
    // Contains an arbitrary serialized message
    String getTypeUrl();
    ByteString getValue();
    static Builder newBuilder();
}

Well-Known Types

JSON Format Support

Utilities for converting protocol buffer messages to and from JSON format, with configurable options and type registry support.

class JsonFormat {
    static class Parser {
        // Parse JSON to protobuf message
        Parser ignoringUnknownFields();
        Parser usingTypeRegistry(TypeRegistry registry);
        void merge(String json, Message.Builder builder);
    }
    
    static class Printer {
        // Convert protobuf message to JSON
        Printer includingDefaultValueFields();
        Printer preservingProtoFieldNames(); 
        String print(MessageOrBuilder message);
    }
    
    static Parser parser();
    static Printer printer();
}

JSON Format Support

Text Format Support

Human-readable text representation of protocol buffer messages for debugging, logging, and configuration files.

class TextFormat {
    // Utilities for converting messages to/from text format
    static String printToString(MessageOrBuilder message);
    static void merge(Readable input, Message.Builder builder) throws IOException;
    static Printer printer();
    static Parser parser();
}

class TextFormatParseException extends IOException {
    // Exception thrown when text format parsing fails
    String getMessage();
    int getLine();
    int getColumn();
}

Extension System

Support for protocol buffer extensions allowing fields to be added to messages without modifying the original .proto files.

class Extension<ContainingType, Type> {
    // Represents a protocol buffer extension
}

class ExtensionRegistry {
    // Registry for protocol buffer extensions
    static ExtensionRegistry newInstance();
    void add(Extension<?, ?> extension);
    ExtensionRegistry getUnmodifiable();
}

class ExtensionRegistryLite {
    // Lite version of extension registry
    static ExtensionRegistryLite newInstance();
}

Extension System

Error Handling

Exception types and error handling mechanisms for protocol buffer operations.

class InvalidProtocolBufferException extends IOException {
    // Exception thrown when parsing invalid protocol buffer data
    static InvalidProtocolBufferException truncatedMessage();
    static InvalidProtocolBufferException negativeSize();
    static InvalidProtocolBufferException malformedVarint();
    static InvalidProtocolBufferException invalidTag();
    static InvalidProtocolBufferException invalidEndTag();
    static InvalidProtocolBufferException invalidWireType();
    static InvalidProtocolBufferException recursionLimitExceeded();
    static InvalidProtocolBufferException sizeLimitExceeded();
}

class UnknownFieldSet implements MessageLite {
    // Container for fields that were parsed but not recognized
    static UnknownFieldSet getDefaultInstance();
    static Builder newBuilder();
    Map<Integer, Field> asMap();
    boolean hasField(int number);
    Field getField(int number);
}