public class OctetStream extends HttpServlet
This will be for testing ability of browsers to read binary data using XmlHTTPRequest objects to read binary data.
The first three unsigned integers contain a value of 512. The next group of integers increment by one until they reach the end.
The code was modified to have a 512x512 matrix in addition to the first two integers in order to present something resembling an actual raster image.
When JavaScript is used with XMLHttpRequest and the ArrayBuffer mode, it apparently reads the data in little endian format (least significant first). The DataOutputStream class writes the data using big endian format (most significant first).
| Constructor and Description |
|---|
OctetStream() |
| Modifier and Type | Method and Description |
|---|---|
void |
service(HttpServletRequest req,
HttpServletResponse res) |
protected static void |
writeShort(OutputStream output,
int value) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicedestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, logpublic OctetStream()
protected static void writeShort(OutputStream output, int value) throws IOException
IOExceptionpublic void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
service in class HttpServletIOExceptionServletExceptionCopyright © 2017. All rights reserved.