com.cc.framework.convert.imp
Class ByteSizeConverter

java.lang.Object
  extended bycom.cc.framework.convert.imp.ByteSizeConverter
All Implemented Interfaces:
Converter

public class ByteSizeConverter
extends java.lang.Object
implements Converter

Converter for Byte sizes

Version:
$Revision$
Author:
Harald Schulz

Field Summary
static java.lang.String CONVERTER_ID
          Converter Id
private static java.lang.String[] SUFFIX
          The Size Units
 
Constructor Summary
ByteSizeConverter()
           
 
Method Summary
 java.lang.Object getAsObject(RequestContext ctx, java.lang.String newValue)
          Converts the given String value into the Converters Datatype
 java.lang.String getAsString(RequestContext ctx, java.lang.Object value)
          Converts the Object of the converters Datatype into it's String representation
static java.lang.String toByteSize(long byteSize)
          Converts a long value into a byte size string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERTER_ID

public static final java.lang.String CONVERTER_ID
Converter Id

See Also:
Constant Field Values

SUFFIX

private static final java.lang.String[] SUFFIX
The Size Units

Constructor Detail

ByteSizeConverter

public ByteSizeConverter()
Method Detail

getAsObject

public java.lang.Object getAsObject(RequestContext ctx,
                                    java.lang.String newValue)
                             throws ConverterException
Description copied from interface: Converter
Converts the given String value into the Converters Datatype

Specified by:
getAsObject in interface Converter
Parameters:
ctx - Request Context
newValue - The String Value to convert
Returns:
Object of the Converters Datatype
Throws:
ConverterException - is thrown when a conversion error occurs
See Also:
Converter.getAsObject(com.cc.framework.adapter.RequestContext, java.lang.String)

getAsString

public java.lang.String getAsString(RequestContext ctx,
                                    java.lang.Object value)
                             throws ConverterException
Description copied from interface: Converter
Converts the Object of the converters Datatype into it's String representation

Specified by:
getAsString in interface Converter
Parameters:
ctx - Request Context
value - The Object to convert
Returns:
String
Throws:
ConverterException - is thrown when a conversion error occurs
See Also:
Converter.getAsString(com.cc.framework.adapter.RequestContext, java.lang.Object)

toByteSize

public static java.lang.String toByteSize(long byteSize)
Converts a long value into a byte size string

Parameters:
byteSize - the size to convert (in bytes)
Returns:
byte size string


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.