you need to serialize a class as an array of bytes without "built-in serialization api" i.e. , as I understand it, do not use wrappers for library input-output streams, but write your own. I can not understand where to dig and what approximate algorithm of actions for this implementation? here is my implementation
public static byte[] documentToByte(Document document) throws TransformerException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); StreamResult result = new StreamResult(bos); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); DOMSource source = new DOMSource(document); transformer.transform(source, result); byte[] data = bos.toByteArray(); return data; }
ByteArrayOutputStreamas the stream. - Mark Shevchenkoправитьbutton) - gil9redTransformer. Seems to want you to write yourTransformer. - Mark Shevchenko