本文整理汇总了Java中net.handle.hdllib.Util.decodeString方法的典型用法代码示例。如果您正苦于以下问题:Java Util.decodeString方法的具体用法?Java Util.decodeString怎么用?Java Util.decodeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.handle.hdllib.Util
的用法示例。
在下文中一共展示了Util.decodeString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHandlesForNA
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Return an enumeration of all the handles for a given naming authority. This could be
* a very expensive call as it retrieves all of the handles at once.
*
* @param namingAuthorityBytes
* @return
* @throws HandleException
*/
@SuppressWarnings("unchecked")
public Enumeration getHandlesForNA(byte[] namingAuthorityBytes) throws HandleException {
log.debug("Get handles for na called ");
String namingAuthority = Util.decodeString(namingAuthorityBytes);
log.debug("Naming authority = " + namingAuthority);
List<HandleInfo> handles = handleService.getAllHandlesForAuthority(namingAuthority);
List<byte[]> handleValues = new LinkedList<byte[]>();
for(HandleInfo hi : handles)
{
String handle = namingAuthority + "/" + hi.getLocalName();
handleValues.add(Util.encodeString(handle));
}
return Collections.enumeration(handleValues);
}
示例2: haveNA
import net.handle.hdllib.Util; //导入方法依赖的package包/类
public boolean haveNA(byte[] naBytes) throws HandleException {
boolean haveNa = false;
String namingAuthority = Util.decodeString(naBytes);
log.debug("checking to see if we have naming authority : " + namingAuthority);
String[] namingAuthorityParts = namingAuthority.split("/");
if( namingAuthorityParts.length < 2 )
{
// false
}
else
{
String prefix = namingAuthorityParts[1];
log.debug("Checing for prefix " + prefix);
if( handleService.getNameAuthority(prefix) != null )
{
haveNa = true;
}
else
{
// false
}
}
log.debug("returning haveNa = " + haveNa);
return haveNa;
}
示例3: getHandles
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Obtain a List of Handle objects belonging to the provided Identifier
* (not used)
*
* @return List<Handle>
* A list of Handle Objects
* @param identifier
* The Identifier object representing the agent whose handles
* are to be returned
* @param startHandle
* The handle from which the list is to be started (exclusive)
* @throws HandleException
* @throws DAOException
*/
public List<String> getHandles(Identifier identifier,
String startHandle) throws DAOException
{
Connection c = null;
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList<String> handleList = new ArrayList<String>();
try
{
c = datasource.getConnection();
c.setAutoCommit(false);
ps = c.prepareStatement(SELECT_HANDLE_FOR_USER_SQL);
ps.setBytes(1, Util.encodeString(identifier.getHandle()));
HandleConfig hc = HandleConfig.getHandleConfig();
int index = hc.getPrefix().length();
int suffix = 0;
if (startHandle != null)
{
suffix = Integer.parseInt(startHandle.substring(index + 1));
}
ps.setBytes(1, Util.encodeString(identifier.getHandle()));
ps.setInt(2, index + 2);
ps.setInt(3, suffix);
ps.setInt(4, index + 2);
rs = ps.executeQuery();
while (rs.next())
{
String s = Util.decodeString(rs.getBytes(1));
handleList.add(s);
}
}
catch (SQLException sqle)
{
log.error("SQLException occurred", sqle);
throw new DAOException(sqle);
}
finally
{
JDBCSupport.closeObjects(rs, ps, c);
}
return handleList;
}
示例4: getHandlesByData
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Obtain a List of Handle objects matching a string
*
* @return List<Handle>
* A list of Handle Objects
* @param data
* A string contained within hamdles handles are to be returned
* @param type
* The handle value type (or null if all types)
* @param pubReadOnly
* Only include publicly readable values (default is <code>false</code>)
* @throws HandleException
* @throws DAOException
*/
public List<String> getHandlesByData(String data,
String type,
boolean pubReadOnly) throws DAOException
{
Connection c = null;
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList<String> handleList = new ArrayList<String>();
try
{
c = datasource.getConnection();
c.setAutoCommit(false);
String statement = null;
if (type != null)
{
statement = SELECT_HANDLES_BY_DATA_TYPE_SQL;
if (pubReadOnly)
{
statement += " AND pub_read=TRUE";
}
ps = c.prepareStatement(statement);
ps.setBytes(1, Util.encodeString(data));
ps.setBytes(2, Util.encodeString(type));
}
else
{
statement = SELECT_HANDLES_BY_DATA_SQL;
if (pubReadOnly)
{
statement += " AND pub_read=TRUE";
}
ps = c.prepareStatement(statement);
ps.setBytes(1, Util.encodeString(data));
}
rs = ps.executeQuery();
while (rs.next())
{
String s = Util.decodeString(rs.getBytes(1));
handleList.add(s);
}
}
catch (SQLException sqle)
{
log.error("SQLException occurred", sqle);
throw new DAOException(sqle);
}
finally
{
JDBCSupport.closeObjects(rs, ps, c);
}
return handleList;
}