|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.net.NetLib
Miscellaneous utilities for using networking. Includes:
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.2-1.0.0, Jul 16 2000, JH Created class - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Constructor Summary | |
NetLib()
|
Method Summary | |
static int |
bytesToLen(byte[] bSize)
Convert the first four bytes in the byte array into an int. |
static URL |
FileNameToURL(String strFileName)
Given a filename, convert it to a URL. |
static String |
getBottomLevelDomainName(String strAddress)
Given an address like "www.cs.berkeley.edu", return "www". |
static String |
getLocalBottomLevelDomainName()
Return the first name of the local machine. |
static byte[] |
lenToBytes(byte[] bPayload)
Take the length of the payload, and convert to bytes, returning the bytes in a newly created array of size 4. |
static byte[] |
lenToBytes(byte[] bPayload,
byte[] bSize)
Take the length of the payload, and convert to bytes, returning the bytes in the byte array passed in. |
static byte[] |
lenToBytes(int len)
Take an int, chops the int into bytes containing the bits, returning the bytes in a newly created byte-array. |
static byte[] |
lenToBytes(int len,
byte[] bSize)
Take an int, chops the int into bytes containing the bits, returning the bytes in the byte array passed in. |
static void |
main(String[] argv)
|
static byte[] |
read(InputStream istream)
Synchronously read using our protocol. |
static String |
URLToFileName(String str)
Given a URL, convert it to a filename. |
static String |
URLToFileName(URL url)
Given a URL, convert it to a filename. |
static void |
write(OutputStream ostream,
byte[] bPayload)
Synchronously write out using our protocol. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NetLib()
Method Detail |
public static byte[] lenToBytes(byte[] bPayload)
bPayload
- is the payload. Automatically takes length of bPayload
to be the full size of the payload.public static byte[] lenToBytes(byte[] bPayload, byte[] bSize)
bPayload
- is the payload. Automatically takes length of bPayload
to be the full size of the payload.bSize
- is the byte array to put the length value in. Must be at
least length 4. Puts the length value into the first
four indices, 0-3.public static byte[] lenToBytes(int len)
len
- is the value to convert to bytes.public static byte[] lenToBytes(int len, byte[] bSize)
len
- is the value to convert to bytes.bSize
- is the byte array to put the length value in. Must be at
least length 4. Puts the length value into the first
four indices, 0-3.public static int bytesToLen(byte[] bSize)
public static void write(OutputStream ostream, byte[] bPayload) throws IOException
Again, the protocol is first four bytes for length of payload, rest of bytes is the payload.
ostream
- is the OutputStream to write out to.bPayload
- is the payload of bytes to write out.public static byte[] read(InputStream istream) throws IOException
Again, the protocol is first four bytes for length of payload, rest of bytes is the payload.
istream
- is the InputStream to read in from.public static String getBottomLevelDomainName(String strAddress)
strAddress
- is the name of the machine.public static String getLocalBottomLevelDomainName()
public static String URLToFileName(URL url)
url
- contains a file protocol url.public static String URLToFileName(String str)
str
- is a String containing a URL.public static URL FileNameToURL(String strFileName)
public static void main(String[] argv) throws Exception
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |