Professional Documents
Culture Documents
Syntax -
<form action="FileStorage" enctype="multipart/form-data" method =
"post">
Syntax -
Part filepart = request.getPart("value");
To convert part of html form i.e. file into byte, make use
of "getInputStream()" present in Part interface.
The return of InputStream class is the superclass of all the
io classes. It represents input stream of bytes.
Syntax -
InputStream is = filepart.getInputStream();
Note: Array size accepts 'int value' but length() will return long
value. Hence, perform narrowing to convert long into int.
Syntax-
OutputStream
1. To display image on browser make use of OutputStream Class
present in java.io package.
2. Helper method for it is "getOutputStream()" which can access
by using response reference variable.
3. OutputStream class consist following three methods.
a. write(byte [] a) - to store all bytes of image in output stream.
b. flush() - to print all bytes in the form image on browser.
c. close() - to close connection between servlet and browser.
The getOutputStream() method of
Java Socket class returns an
output stream for the given
socket. If you close the returned
OutputStream then it will close the
linked socket.
A socket is one endpoint of a two-
way communication link between
two programs running on the
network. A socket is bound to a
port number so that the TCP layer
can identify the application that data
is destined to be sent to. An
endpoint is a combination of an IP
address and a port number.
Large objects ---> blob(binary large
object ex. Images, audio, files and
video files) and clob(Character
large object text files, rich text files,
etc.)