Thread: [Jsdsi-devel] jsdsi.Obj convenience methods
Status: Pre-Alpha
Brought to you by:
sajma
|
From: Sean R. <sra...@ae...> - 2004-03-15 11:12:47
|
Any objections to me adding the following convenience methods to
jsdsi.Obj:
/**
* Returns the S-expression representation of this SPKI/SDSI object in
readable form.
* @param offset spaces indented from left.
* @param width total width of window, in characters.
* @param last spaces reserved on right (e.g., for closing parens)
* @return the S-expression
*/
public String toString(int offset, int width, int last) {
try {
StringWriter sw = new StringWriter();
this.toSexp().writeReadable(sw, offset, width, last);
return sw.toString();
} catch (IOException e) {
throw new Error(e);
}
}
/**
* Returns the S-expression representation of this SPKI/SDSI object in
transport form.
* @return the S-expression
*/
public String toTransport() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
this.toSexp().writeTransport(baos);
return baos.toString();
} catch (IOException e) {
throw new Error(e);
}
}
Regards,
Sean
--
Dr. Sean Radford, MBBS, MSc
sra...@ae...
http://www.aegeus-technology.com
|
|
From: Luis P. <lp...@ne...> - 2004-03-15 11:49:40
|
Then, i've to take toTransport of LDAPAttributes. :)
-- Luis Pedro
=20
=BB -----Original Message-----
=BB From: jsd...@li...=20
=BB [mailto:jsd...@li...] On Behalf=20
=BB Of Sean Radford
=BB Sent: segunda-feira, 15 de Mar=E7o de 2004 11:10
=BB To: devel jsdsi
=BB Subject: [Jsdsi-devel] jsdsi.Obj convenience methods
=BB =20
=BB Any objections to me adding the following convenience methods to
=BB jsdsi.Obj:
=BB =20
=BB /**
=BB * Returns the S-expression representation of this=20
=BB SPKI/SDSI object in readable form.
=BB * @param offset spaces indented from left.
=BB * @param width total width of window, in characters.
=BB * @param last spaces reserved on right (e.g., for closing parens)
=BB * @return the S-expression
=BB */
=BB public String toString(int offset, int width, int last) {
=BB try {
=BB StringWriter sw =3D new StringWriter();
=BB this.toSexp().writeReadable(sw, offset, width, last);
=BB return sw.toString();
=BB } catch (IOException e) {
=BB throw new Error(e);
=BB }
=BB }
=BB =20
=BB /**
=BB * Returns the S-expression representation of this=20
=BB SPKI/SDSI object in transport form.
=BB * @return the S-expression
=BB */
=BB public String toTransport() {
=BB try {
=BB ByteArrayOutputStream baos =3D new ByteArrayOutputStream();
=BB this.toSexp().writeTransport(baos);
=BB return baos.toString();
=BB } catch (IOException e) {
=BB throw new Error(e);
=BB }
=BB }
=BB =20
=BB =20
=BB Regards,
=BB =20
=BB Sean
=BB --
=BB Dr. Sean Radford, MBBS, MSc
=BB sra...@ae...
=BB http://www.aegeus-technology.com
=BB =20
=BB =20
=BB =20
=BB -------------------------------------------------------
=BB This SF.Net email is sponsored by: IBM Linux Tutorials
=BB Free Linux tutorial presented by Daniel Robbins, President=20
=BB and CEO of
=BB GenToo technologies. Learn everything from fundamentals to system
=BB administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638
=BB &op=3Dclick
=BB _______________________________________________
=BB Jsdsi-devel mailing list
=BB Jsd...@li...
=BB https://lists.sourceforge.net/lists/listinfo/jsdsi-devel
|
|
From: Sameer A. <aj...@cs...> - 2004-03-15 12:36:59
|
Just one change: > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > this.toSexp().writeTransport(baos); > return baos.toString(); This call to toString() uses the platform's default encoding, but SPKI requires 8859_1. Perhaps use Sexp.decodeString(baos.toByteArray()); Sameer |
|
From: Sameer A. <aj...@cs...> - 2004-03-15 13:19:01
|
The purpose of transport form is to provide a concise, 7-bit clean encoding of a canonical S-expression. But most JSDSI methods that read or write transport form use a byte array or OutputStream instead of a String or Writer. Should we change transport form methods to use Strings and Writers? Note that one can always use Sexp.decodeString() and OutputStreamWriter to bridge between the two forms. Sameer > Just one change: > >> ByteArrayOutputStream baos = new ByteArrayOutputStream(); >> this.toSexp().writeTransport(baos); >> return baos.toString(); > > This call to toString() uses the platform's default encoding, but SPKI > requires 8859_1. Perhaps use Sexp.decodeString(baos.toByteArray()); > > Sameer > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Jsdsi-devel mailing list > Jsd...@li... > https://lists.sourceforge.net/lists/listinfo/jsdsi-devel http://ajmani.net |
|
From: Sean R. <sra...@ae...> - 2004-03-15 16:48:03
|
On Mon, 2004-03-15 at 13:18, Sameer Ajmani wrote: > The purpose of transport form is to provide a concise, 7-bit clean > encoding of a canonical S-expression. But most JSDSI methods that read or > write transport form use a byte array or OutputStream instead of a String > or Writer. Should we change transport form methods to use Strings and > Writers? Note that one can always use Sexp.decodeString() and > OutputStreamWriter to bridge between the two forms. > My preference is to stick as we are, make sure the documentation (javadoc) highlights the issue and informs developers of how to convert. > Sameer > > > Just one change: > > > >> ByteArrayOutputStream baos = new ByteArrayOutputStream(); > >> this.toSexp().writeTransport(baos); > >> return baos.toString(); > > > > This call to toString() uses the platform's default encoding, but SPKI > > requires 8859_1. Perhaps use Sexp.decodeString(baos.toByteArray()); > > > > Sameer > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President and CEO of > > GenToo technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > _______________________________________________ > > Jsdsi-devel mailing list > > Jsd...@li... > > https://lists.sourceforge.net/lists/listinfo/jsdsi-devel > > > http://ajmani.net > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Jsdsi-devel mailing list > Jsd...@li... > https://lists.sourceforge.net/lists/listinfo/jsdsi-devel -- Dr. Sean Radford, MBBS, MSc sra...@ae... http://www.aegeus-technology.com |
|
From: Sameer A. <aj...@cs...> - 2004-03-15 16:53:58
|
> My preference is to stick as we are, make sure the documentation > (javadoc) highlights the issue and informs developers of how to convert. This is probably the best plan, as it also avoid breaking existing apps :) Sameer > On Mon, 2004-03-15 at 13:18, Sameer Ajmani wrote: >> The purpose of transport form is to provide a concise, 7-bit clean >> encoding of a canonical S-expression. But most JSDSI methods that >> read or write transport form use a byte array or OutputStream instead >> of a String or Writer. Should we change transport form methods to use >> Strings and Writers? Note that one can always use Sexp.decodeString() >> and >> OutputStreamWriter to bridge between the two forms. >> > > >> Sameer >> >> > Just one change: >> > >> >> ByteArrayOutputStream baos = new ByteArrayOutputStream(); >> this.toSexp().writeTransport(baos); >> >> return baos.toString(); >> > >> > This call to toString() uses the platform's default encoding, but >> SPKI requires 8859_1. Perhaps use >> Sexp.decodeString(baos.toByteArray()); >> > >> > Sameer >> > >> > >> > >> > >> > >> > ------------------------------------------------------- >> > This SF.Net email is sponsored by: IBM Linux Tutorials >> > Free Linux tutorial presented by Daniel Robbins, President and CEO >> of GenToo technologies. Learn everything from fundamentals to system >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >> _______________________________________________ >> > Jsdsi-devel mailing list >> > Jsd...@li... >> > https://lists.sourceforge.net/lists/listinfo/jsdsi-devel >> >> >> http://ajmani.net >> >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: IBM Linux Tutorials >> Free Linux tutorial presented by Daniel Robbins, President and CEO of >> GenToo technologies. Learn everything from fundamentals to system >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >> _______________________________________________ >> Jsdsi-devel mailing list >> Jsd...@li... >> https://lists.sourceforge.net/lists/listinfo/jsdsi-devel > -- > Dr. Sean Radford, MBBS, MSc > sra...@ae... > http://www.aegeus-technology.com http://ajmani.net |
|
From: Sean R. <sra...@ae...> - 2004-03-15 17:32:54
|
Just to let you all know - I've committed the convenience methods (with Sexp.decodeString(...) to use 8859_1. Sean On Mon, 2004-03-15 at 16:53, Sameer Ajmani wrote: > > My preference is to stick as we are, make sure the documentation > > (javadoc) highlights the issue and informs developers of how to convert. > > This is probably the best plan, as it also avoid breaking existing apps :) > > Sameer > > > On Mon, 2004-03-15 at 13:18, Sameer Ajmani wrote: > >> The purpose of transport form is to provide a concise, 7-bit clean > >> encoding of a canonical S-expression. But most JSDSI methods that > >> read or write transport form use a byte array or OutputStream instead > >> of a String or Writer. Should we change transport form methods to use > >> Strings and Writers? Note that one can always use Sexp.decodeString() > >> and > >> OutputStreamWriter to bridge between the two forms. > >> > > > > > >> Sameer > >> > >> > Just one change: > >> > > >> >> ByteArrayOutputStream baos = new ByteArrayOutputStream(); > >> this.toSexp().writeTransport(baos); > >> >> return baos.toString(); > >> > > >> > This call to toString() uses the platform's default encoding, but > >> SPKI requires 8859_1. Perhaps use > >> Sexp.decodeString(baos.toByteArray()); > >> > > >> > Sameer > >> > > >> > > >> > > >> > > >> > > >> > ------------------------------------------------------- > >> > This SF.Net email is sponsored by: IBM Linux Tutorials > >> > Free Linux tutorial presented by Daniel Robbins, President and CEO > >> of GenToo technologies. Learn everything from fundamentals to system > >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > >> _______________________________________________ > >> > Jsdsi-devel mailing list > >> > Jsd...@li... > >> > https://lists.sourceforge.net/lists/listinfo/jsdsi-devel > >> > >> > >> http://ajmani.net > >> > >> > >> > >> > >> > >> ------------------------------------------------------- > >> This SF.Net email is sponsored by: IBM Linux Tutorials > >> Free Linux tutorial presented by Daniel Robbins, President and CEO of > >> GenToo technologies. Learn everything from fundamentals to system > >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > >> _______________________________________________ > >> Jsdsi-devel mailing list > >> Jsd...@li... > >> https://lists.sourceforge.net/lists/listinfo/jsdsi-devel > > -- > > Dr. Sean Radford, MBBS, MSc > > sra...@ae... > > http://www.aegeus-technology.com > > > http://ajmani.net > -- Dr. Sean Radford, MBBS, MSc sra...@ae... http://www.aegeus-technology.com |