Class ForkBootstrap
java.lang.Object
org.apache.tika.pipes.core.protocol.ForkBootstrap
What the parent hands a forked PipesServer on its stdin before anything else: an auth
token and the parent's config. The fork presents the token as the first bytes of every
socket connection so the other end can reject a stranger that connected first.
Frame: 32-byte token, int config length, config JSON.
The config's ${env:...} references are resolved by the parent, never by the fork.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckToken(InputStream in, byte[] expected) Reads 32 bytes and compares them toexpectedin constant time.byte[]getToken()Loads the config without resolving env references: the parent already did.static byte[]newToken()static ForkBootstrapread(InputStream in) static byte[]toBytes(TikaJsonConfig tikaJsonConfig) Serializes the parent's loaded config.static voidwrite(OutputStream out, byte[] token, byte[] config)
-
Field Details
-
TOKEN_LENGTH_BYTES
public static final int TOKEN_LENGTH_BYTES- See Also:
-
-
Method Details
-
newToken
public static byte[] newToken() -
toBytes
Serializes the parent's loaded config. Its env references are already resolved, so the bytes may carry secrets; they travel only over the fork's stdin.- Throws:
IOException
-
write
- Throws:
IOException
-
read
- Throws:
IOException
-
checkToken
Reads 32 bytes and compares them toexpectedin constant time. False on a short read or a mismatch.- Throws:
IOException
-
getToken
public byte[] getToken() -
loadConfig
Loads the config without resolving env references: the parent already did.- Throws:
TikaConfigException
-