public static class ToDafny.Simple
extends java.lang.Object
| Constructor and Description |
|---|
Simple() |
| Modifier and Type | Method and Description |
|---|---|
static dafny.DafnySequence<java.lang.Byte> |
ByteSequence(byte[] blob) |
static dafny.DafnySequence<java.lang.Byte> |
ByteSequence(java.nio.ByteBuffer byteBuffer)
A convenience function for converting all the bytes from a ByteBuffer.
|
static dafny.DafnySequence<java.lang.Byte> |
ByteSequence(java.nio.ByteBuffer byteBuffer,
int start,
int limit)
Copy
limit bytes from byteBuffer starting at start,
and return them as a Dafny Runtime DafnySequence of Bytes. |
static dafny.DafnySequence<java.lang.Character> |
CharacterSequence(java.util.Date timestamp)
At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.
|
static dafny.DafnySequence<java.lang.Character> |
CharacterSequence(java.time.Instant timestamp)
At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.
|
static dafny.DafnySequence<java.lang.Character> |
CharacterSequence(java.lang.String aString) |
static dafny.DafnySequence<java.lang.Byte> |
DafnyUtf8Bytes(java.lang.String aString)
Dafny can be configured to represent Strings in an encoding OTHER THAN UTF-8.
|
static dafny.DafnySequence<java.lang.Byte> |
Double(java.lang.Double aDouble)
At this time, Dafny does not have an idiomatic Double type in the language or any standard library.
|
public static dafny.DafnySequence<java.lang.Byte> ByteSequence(byte[] blob)
blob - The Java type for a blob can be an array of bytes.DafnySequence of Bytes.ToNative.Simple.ByteBuffer(dafny.DafnySequence<? extends java.lang.Byte>)public static dafny.DafnySequence<java.lang.Byte> ByteSequence(java.nio.ByteBuffer byteBuffer,
int start,
int limit)
limit bytes from byteBuffer starting at start,
and return them as a Dafny Runtime DafnySequence of Bytes.byteBuffer - The Java type for a blob can be a ByteBuffer.start - The index in the byteBuffer from which to start at.limit - The number of bytes to copy.DafnySequence of Bytes, containing the copied bytes.ToNative.Simple.ByteBuffer(dafny.DafnySequence<? extends java.lang.Byte>)public static dafny.DafnySequence<java.lang.Byte> ByteSequence(java.nio.ByteBuffer byteBuffer)
Note: Regardless of the buffer's mark, position, or capacity, this will return the bytes from 0 till limit.
byteBuffer - The Java type for a blob can be a ByteBuffer.DafnySequence of Bytes,
containing the bytes in the byteBuffer,
starting from 0 until the buffer's limit.ToNative.Simple.ByteBuffer(dafny.DafnySequence<? extends java.lang.Byte>)public static dafny.DafnySequence<java.lang.Byte> Double(java.lang.Double aDouble)
Instead, the Double is serialized into bytes, which are then wrapped as a DafnySequence of Bytes.
Note: This serialization is NOT guaranteed to be consistent among different Dafny Runtimes or even native distributions.
aDouble - The Java type for a double can be a Double.DafnySequence of Bytes containing the serialization of the aDouble.ToNative.Simple.Double(dafny.DafnySequence<? extends java.lang.Byte>)public static dafny.DafnySequence<java.lang.Character> CharacterSequence(java.lang.String aString)
aString - The Java type for a String is String.DafnySequence of Characters.ToNative.Simple.String(dafny.DafnySequence<? extends java.lang.Character>)public static dafny.DafnySequence<java.lang.Character> CharacterSequence(java.util.Date timestamp)
Instead, the Timestamp is serialized as seconds from epoch, as a string,
which is than wrapped as a DafnySequence of Characters.
timestamp - The Java type for a Smithy timestamp can be Date.DafnySequence of Characters containing the serialization of the timestamp.ToNative.Simple.Date(DafnySequence)public static dafny.DafnySequence<java.lang.Character> CharacterSequence(java.time.Instant timestamp)
Instead, the Timestamp is serialized as seconds from epoch, as a string, which is than wrapped as a DafnySequence of Charters.
timestamp - The Java type for a timestamp can be Instant.DafnySequence of Characters containing the serialization of the timestamp.ToNative.Simple.Instant(DafnySequence)public static dafny.DafnySequence<java.lang.Byte> DafnyUtf8Bytes(java.lang.String aString)
(Until recently, it only supported UTF-16.)
Regardless of how the Dafny Compiler is configured, this method can be used to reliably convert a Java String to a DafnySequence of UTF-8 Encoded bytes.
aString - The Java type for a String is StringDafnySequence of Bytes containing aString as UTF-8 Encoded Bytes.ToNative.Simple.DafnyUtf8Bytes(DafnySequence)