Skip to main content

ByteBuffer

Struct ByteBuffer 

Source
pub struct ByteBuffer(/* private fields */);
Expand description

java.nio.ByteBuffer

Implementations§

Source§

impl ByteBuffer

Source

pub fn new(e: &mut Env<'_>, bytes: impl IntoIterator<Item = u8>) -> Self

java.nio.ByteBuffer.wrap(byte[])

Source

pub fn from_buf(buf: Buffer) -> Self

Upcast Buffer to ByteBuffer

Source

pub fn as_buf(&self, e: &mut Env<'_>) -> Buffer

Downcast self to Buffer (superclass of ByteBuffer)

Source

pub fn len(&self, e: &mut Env<'_>) -> u32

java.nio.Buffer.capacity()

Source

pub fn rewind(&self, e: &mut Env<'_>)

java.nio.ByteBuffer.rewind()

Source

pub fn position(&self, e: &mut Env<'_>) -> u32

java.nio.Buffer.position()

Source

pub fn write_to( &self, e: &mut Env<'_>, start: usize, end: usize, buf: &mut [u8], ) -> usize

Write the contents of this byte buffer to a rust buffer

Source

pub fn to_vec(&self, e: &mut Env<'_>) -> Vec<u8>

Extract the contents of this byte buffer to a vec of bytes

Trait Implementations§

Source§

impl Class for ByteBuffer

Source§

const PATH: &'static str = "java/nio/ByteBuffer"

The fully qualified java class path (slash-separated) Read more
Source§

impl Object for ByteBuffer

Source§

fn upcast<'a, 'e>(_: &'a mut Env<'e>, jobj: Object) -> Self

Try to interpret an object as Self
Source§

fn downcast<'a, 'e>(self, _: &'a mut Env<'e>) -> Object

Create an object reference from self
Source§

fn downcast_ref<'a, 'e>(&'a self, e: &'a mut Env<'e>) -> Object

Create an object reference from &self
Source§

fn upcast_value_ref<'e>(e: &mut Env<'e>, jv: JValue<'e, '_>) -> Self
where Self: Sized,

Try to interpret a JValue as Self
Source§

fn upcast_value<'e>(e: &mut Env<'e>, jv: JValueOwned<'e>) -> Self
where Self: Sized,

Try to interpret a JValueOwned as Self
Source§

fn downcast_value<'e>(self, e: &mut Env<'e>) -> JValueOwned<'e>
where Self: Sized,

Create a JValueOwned from self
Source§

fn yield_to_java(&self, e: &mut Env<'_>) -> jobject

Use this to yield ownership of a java::lang::Object to the JVM, for example when returning a jobject from a native function.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<F, A, TF, T> Sequence<F, A, TF> for T

Source§

fn sequence<Ap>(self) -> <Ap as HKT1>::T<<F as HKT1>::T<A>>
where Self: Sized + Traversable<F, <Ap as HKT1>::T<A>, A, TF> + Foldable<F, <Ap as HKT1>::T<A>>, Ap: HKT1, <Ap as HKT1>::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, <Ap as HKT1>::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, <Ap as HKT1>::T<<F as HKT1>::T<A>>: Applicative<Ap, <F as HKT1>::T<A>> + ApplyOnce<Ap, <F as HKT1>::T<A>>, F: HKT1<T<<Ap as HKT1>::T<A>> = Self>,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Type for T
where T: Class,

Source§

const SIG: Signature = const SIG: Signature = Signature::class(T::PATH);

The signature for this type
Source§

fn jni() -> JavaType

Get the jni rep of this type
Source§

fn is_type_of(e: &mut Env<'_>, o: &JObject<'_>) -> bool

Determines whether an object is an instance of this type
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,