java.lang.Object
cs1302.tracer.api.SourceBundle
Immutable, ordered source files packaged in the tracer's delimited source format.
Every file, including a single-file bundle, has a canonical
// --- path.java ---
header followed by LF. Original text, byte-order marks, and line endings are preserved.
Before a subsequent header, one LF is added only when the preceding text does not already
end with a delimiter-recognized line terminator. Empty files need no additional separator.
The final file's text is not given an extra terminator.
Construction validates packaging, not compilation or entry-point availability. Explicitly named
files may contain empty or invalid Java text. Inferred names require parseable source with exactly
one public top-level type, or otherwise exactly one top-level type. Use source() with
TraceRequest.builder(String) or an existing source-text constructor.
File additions capture text immediately; later filesystem changes do not alter a built bundle.
Binary dependencies are selected separately through TraceClassPath.
Logical paths name the packaged inputs. Executable locations returned in
BreakpointDiscovery instead use package-relative debug source paths, which can differ
from logical paths such as src/demo/Main.java.
- Since:
- 4.1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable, reusable source packaging; not thread-safe. -
Method Summary
Modifier and TypeMethodDescriptionstatic SourceBundle.Builderbuilder()Creates an empty builder; add at least one file before building.Opens a fresh stream containing the UTF-8 encoding ofsource().source()Returns the delimited source text for tracing, discovery, or other source-text consumers.Copies the captured original paths and text into an independent builder without rereading files.voidwriteUtf8(OutputStream destination) Writes the UTF-8 encoding ofsource()without flushing or closing the caller's destination.
-
Method Details
-
builder
Creates an empty builder; add at least one file before building.- Returns:
- A new mutable builder.
-
toBuilder
Copies the captured original paths and text into an independent builder without rereading files.- Returns:
- A mutable builder initialized with this bundle's files in their original order.
-
source
Returns the delimited source text for tracing, discovery, or other source-text consumers. Headers are part of this transport string; each file's original text follows its header. Calling this method performs no filesystem access or Java parsing.- Returns:
- The immutable delimited source string.
-
openStream
Opens a fresh stream containing the UTF-8 encoding ofsource(). Each stream has independent bytes and cursor state, including when transferred to a custom output stream.- Returns:
- A new caller-owned input stream positioned at its beginning.
-
writeUtf8
Writes the UTF-8 encoding ofsource()without flushing or closing the caller's destination. The destination receives fresh bytes and cannot alter this bundle by retaining or modifying them.- Parameters:
destination- Caller-owned output stream.- Throws:
NullPointerException- If the destination is null.IOException- If the destination cannot accept the bytes.
-