BsonUtil

public class BsonUtil

Class BsonUtil. Provides bsonutil functionality for the Hytale server.

java.lang.Object > BsonUtil

Field Summary

resolve

final Path resolve

Field resolve.

parent

final Path parent

Field parent.

json

final String json

Field json.

future

final CompletableFuture future

Field future.

file

final Path file

Field file.

writer

final StringWriter writer

Field writer.

extraInfo

final ExtraInfo extraInfo

Field extraInfo.

bsonValue

final BsonValue bsonValue

Field bsonValue.

document

final BsonDocument document

Field document.

Method Detail

writeToBytes

static byte[] writeToBytes (@Nullable final BsonDocument document)

Method writeToBytes.

Parameters:
@Nullable final BsonDocument document

BasicOutputBuffer

public new BasicOutputBuffer ()

Method BasicOutputBuffer.

BsonBinaryWriter

public new BsonBinaryWriter (buffer)

Method BsonBinaryWriter.

Parameters:
buffer buffer

readFromBytes

static BsonDocument readFromBytes (@Nullable final byte[] buf)

Method readFromBytes.

Parameters:
@Nullable final byte[] buf

BsonBinaryReader

public new BsonBinaryReader (ByteBuffer.wrap(buf)

Method BsonBinaryReader.

Parameters:
ByteBuffer.wrap(buf ByteBuffer.wrap(buf

readFromBuffer

static BsonDocument readFromBuffer (@Nullable final ByteBuffer buf)

Method readFromBuffer.

Parameters:
@Nullable final ByteBuffer buf

readFromBinaryStream

static BsonDocument readFromBinaryStream (@Nonnull final ByteBuf buf)

Method readFromBinaryStream.

Parameters:
@Nonnull final ByteBuf buf

writeToBinaryStream

static void writeToBinaryStream (@Nonnull final ByteBuf buf, final BsonDocument doc)

Method writeToBinaryStream.

Parameters:
@Nonnull final ByteBuf buf
final BsonDocument doc

writeDocumentBytes

static CompletableFuture writeDocumentBytes (@Nonnull final Path file, final BsonDocument document)

Method writeDocumentBytes.

Parameters:
@Nonnull final Path file
final BsonDocument document

writeDocument

static CompletableFuture writeDocument (@Nonnull final Path file, final BsonDocument document)

Method writeDocument.

Parameters:
@Nonnull final Path file
final BsonDocument document

readDocument

static CompletableFuture readDocument (@Nonnull final Path file)

Method readDocument.

Parameters:
@Nonnull final Path file

readDocumentNow

static BsonDocument readDocumentNow (@Nonnull final Path file)

Method readDocumentNow.

Parameters:
@Nonnull final Path file

translateJsonToBson

static BsonValue translateJsonToBson (@Nonnull final JsonElement element)

Method translateJsonToBson.

Parameters:
@Nonnull final JsonElement element

BsonString

public new BsonString (element.getAsString()

Method BsonString.

Parameters:
element.getAsString( element.getAsString(

translateBsonToJson

static JsonElement translateBsonToJson (final BsonDocument value)

Method translateBsonToJson.

Parameters:
final BsonDocument value

StringWriter

public new StringWriter ()

Method StringWriter.

JsonWriter

public new JsonWriter (writer, BsonUtil.SETTINGS)

Method JsonWriter.

Parameters:
writer writer
BsonUtil.SETTINGS BsonUtil.SETTINGS

toJson

static String toJson (final BsonDocument document)

Method toJson.

Parameters:
final BsonDocument document

writeSync

static void writeSync (@Nonnull final Path path, @Nonnull final Codec codec, final T value, @Nonnull final HytaleLogger logger)

Method writeSync.

Parameters:
@Nonnull final Path path
@Nonnull final Codec codec
final T value
@Nonnull final HytaleLogger logger