pub trait StringWrite: Sealed {
// Required methods
fn write_string_u16_le_len_utf8(&mut self, string: &str) -> Result<usize>;
fn write_string_u16_be_len_utf8(&mut self, string: &str) -> Result<usize>;
fn write_string_u32_le_len_utf8(&mut self, string: &str) -> Result<usize>;
fn write_string_u32_be_len_utf8(&mut self, string: &str) -> Result<usize>;
fn write_string_zero_terminated_utf8(
&mut self,
string: &str,
) -> Result<usize>;
fn write_string_utf8(&mut self, string: &str) -> Result<usize>;
fn write_string_utf16_be(&mut self, string: &str) -> Result<usize>;
fn write_string_utf16_le(&mut self, string: &str) -> Result<usize>;
fn write_string_utf32_be(&mut self, string: &str) -> Result<usize>;
fn write_string_utf32_le(&mut self, string: &str) -> Result<usize>;
fn write_java_data_output_utf(&mut self, string: &str) -> Result<usize>;
}Expand description
Trait that provides various methods to write strings. Automatically implemented for all implementations of io::Write. This trait is sealed and cannot be implemented manually.
Required Methods§
Sourcefn write_string_u16_le_len_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_u16_le_len_utf8(&mut self, string: &str) -> Result<usize>
Writes an u16 little endian length prefix followed by an utf-8 representation of the string Returns the total amount of bytes written
Sourcefn write_string_u16_be_len_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_u16_be_len_utf8(&mut self, string: &str) -> Result<usize>
Writes an u16 big endian length prefix followed by an utf-8 representation of the string Returns the total amount of bytes written
Sourcefn write_string_u32_le_len_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_u32_le_len_utf8(&mut self, string: &str) -> Result<usize>
Writes an u32 little endian length prefix followed by an utf-8 representation of the string Returns the total amount of bytes written
Sourcefn write_string_u32_be_len_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_u32_be_len_utf8(&mut self, string: &str) -> Result<usize>
Writes an u32 big endian length prefix followed by an utf-8 representation of the string Returns the total amount of bytes written
Sourcefn write_string_zero_terminated_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_zero_terminated_utf8(&mut self, string: &str) -> Result<usize>
Writes an utf-8 representation of the string and a zero byte. If the string ends with a null char then no zero byte is appended. If the string contains a null char in the middle then the method fails. Returns the total amount of bytes written
Sourcefn write_string_utf8(&mut self, string: &str) -> Result<usize>
fn write_string_utf8(&mut self, string: &str) -> Result<usize>
Writes an utf-8 representation of the string Returns the total amount of bytes written
Sourcefn write_string_utf16_be(&mut self, string: &str) -> Result<usize>
fn write_string_utf16_be(&mut self, string: &str) -> Result<usize>
Writes an utf-16-be representation of the string Returns the total amount of bytes written
Sourcefn write_string_utf16_le(&mut self, string: &str) -> Result<usize>
fn write_string_utf16_le(&mut self, string: &str) -> Result<usize>
Writes an utf-16-le representation of the string Returns the total amount of bytes written
Sourcefn write_string_utf32_be(&mut self, string: &str) -> Result<usize>
fn write_string_utf32_be(&mut self, string: &str) -> Result<usize>
Writes an utf-32-be representation of the string Returns the total amount of bytes written
Sourcefn write_string_utf32_le(&mut self, string: &str) -> Result<usize>
fn write_string_utf32_le(&mut self, string: &str) -> Result<usize>
Writes an utf-32-le representation of the string Returns the total amount of bytes written
Sourcefn write_java_data_output_utf(&mut self, string: &str) -> Result<usize>
fn write_java_data_output_utf(&mut self, string: &str) -> Result<usize>
Writes a string that can be read by a java program using the java.io.DataInput#readUTF facility. In general, it writes a big endian u16 to indicate how many bytes it will write. Each character is a re-encoded utf-16 representation of the string.
- The string is utf-16 encoded
- Each u16 of the utf-16 is encoded as 1,2 or 3 bytes using a custom java specific encoding. Returns the total amount of bytes written