Class net.nntp.NntpClient
All Packages This Package Previous Next
Class net.nntp.NntpClient
java.lang.Object
|
+----net.NetworkClient
|
+----net.TransferProtocolClient
|
+----net.nntp.NntpClient
-
public class
NntpClient
-
extends TransferProtocolClient
This class implements network news clients (NNTP).
-
Version:
-
1.9, 12 Dec 1994
-
Author:
-
Jonathan Payne, James Gosling
-
NntpClient()
-
-
NntpClient(String)
-
Create new NNTP Client connected to host host
-
askServer(String)
-
Sends command cmd to the server.
-
finishPost()
-
Finish posting a message.
-
getArticle(int)
-
get article n from the current group.
-
getArticle(String)
-
get article id from the current group.
-
getGroup(String)
-
Get information about group name.
-
getHeader(int)
-
get header of article n from the current group.
-
getHeader(String)
-
get header of article id from the current group.
-
openServer(String, int)
-
Open a connection to the NNTP server.
-
setGroup(String)
-
Set the current group to name
-
startPost()
-
Setup to post a message.
NntpClient
public NntpClient()
NntpClient
public NntpClient(String host)
-
Create new NNTP Client connected to host host
openServer
public void openServer(String name,
int port)
-
Open a connection to the NNTP server.
-
Throws: NntpProtocolException
-
did not get the correct welcome message
-
Overrides:
-
openServer in class NetworkClient
askServer
public int askServer(String cmd)
-
Sends command cmd to the server.
getGroup
public NewsgroupInfo getGroup(String name)
-
Get information about group name.
-
Throws: UnknownNewsgroupException
-
the group name wasn't active.
-
Throws: NntpProtocolException
-
received an unexpected reply.
setGroup
public void setGroup(String name)
-
Set the current group to name
getArticle
public InputStream getArticle(int n)
-
get article n from the current group.
getArticle
public InputStream getArticle(String id)
-
get article id from the current group.
getHeader
public InputStream getHeader(int n)
-
get header of article n from the current group.
getHeader
public InputStream getHeader(String id)
-
get header of article id from the current group.
startPost
public PrintStream startPost()
-
Setup to post a message. It returns a stream
to which the article should be written. Returns null if the post
is disallowed. The article must have a properly formed RFC850 header
and end-of-lines must by sent as \r\n. The Article must end with
\r\n
finishPost
public boolean finishPost()
-
Finish posting a message. Must be called after calling startPost
and writing the article. Returns true if the article is posted
successfully.
All Packages This Package Previous Next