Java 类org.eclipse.emf.ecore.xml.type.internal.DataValue.Base64 实例源码
项目:gemoc-studio-modeldebugging
文件:DSLBreakpoint.java
/**
* Encodes the {@link DSLBreakpoint#IMAGE_ATTRIBUTE}.
*
* @param image
* the {@link Object} image
* @return the attribute {@link String}
* @throws IOException
* if encoding fails
*/
private static String toAttribute(Object image) throws IOException {
final String res;
StringBuffer buffer = new StringBuffer();
if (image instanceof ComposedImage) {
toAttribute(buffer, (ComposedImage)image);
if (buffer.length() != 0) {
res = buffer.substring(0, buffer.length() - 1);
} else {
res = buffer.toString();
}
} else if (image instanceof URL) {
buffer.append(Base64.encode((URL_MARKER + (URL)image).toString().getBytes(UTF8)));
res = buffer.toString();
} else if (image instanceof URI) {
buffer.append(Base64.encode(((URI_MARKER + (URI)image).toString()).getBytes(UTF8)));
res = buffer.toString();
} else {
res = toAttribute(DebugEditPlugin.INSTANCE.getImage(FULL_OBJ16_BREAKPOINT));
}
return res;
}
项目:ModelDebugging
文件:DSLBreakpoint.java
/**
* Encodes the {@link DSLBreakpoint#IMAGE_ATTRIBUTE}.
*
* @param image
* the {@link Object} image
* @return the attribute {@link String}
* @throws IOException
* if encoding fails
*/
private static String toAttribute(Object image) throws IOException {
final String res;
StringBuffer buffer = new StringBuffer();
if (image instanceof ComposedImage) {
toAttribute(buffer, (ComposedImage)image);
if (buffer.length() != 0) {
res = buffer.substring(0, buffer.length() - 1);
} else {
res = buffer.toString();
}
} else if (image instanceof URL) {
buffer.append(Base64.encode((URL_MARKER + (URL)image).toString().getBytes(UTF8)));
res = buffer.toString();
} else if (image instanceof URI) {
buffer.append(Base64.encode(((URI_MARKER + (URI)image).toString()).getBytes(UTF8)));
res = buffer.toString();
} else {
res = toAttribute(DebugEditPlugin.INSTANCE.getImage(FULL_OBJ16_BREAKPOINT));
}
return res;
}
项目:waqtsalat-eclipse-plugin
文件:WaqtSalatPreferenceStore.java
private static String serializeToString(Object object) throws IOException {
ByteArrayOutputStream arrayOutputStream = null;
EclipseObjectOutputStream objectOutputStream = null;
try {
arrayOutputStream = new ByteArrayOutputStream(8192);
objectOutputStream = new EclipseObjectOutputStream(arrayOutputStream);
objectOutputStream.writeObject(object);
objectOutputStream.flush();
return Base64.encode(arrayOutputStream.toByteArray());
} finally {
closeQuietly(arrayOutputStream, objectOutputStream);
}
}
项目:gemoc-studio-modeldebugging
文件:DSLBreakpoint.java
/**
* Encodes the given {@link ComposedImage}.
*
* @param buffer
* the result {@link StringBuffer}
* @param image
* the {@link ComposedImage}
* @throws IOException
* if encoding fails
*/
private static void toAttribute(StringBuffer buffer, ComposedImage image) throws IOException {
for (Object object : image.getImages()) {
if (object instanceof ComposedImage) {
toAttribute(buffer, (ComposedImage)image);
} else if (object instanceof URL) {
buffer.append(Base64.encode(((URL)object).toString().getBytes(UTF8)));
}
buffer.append(DELIMITER);
}
}
项目:ModelDebugging
文件:DSLBreakpoint.java
/**
* Encodes the given {@link ComposedImage}.
*
* @param buffer
* the result {@link StringBuffer}
* @param image
* the {@link ComposedImage}
* @throws IOException
* if encoding fails
*/
private static void toAttribute(StringBuffer buffer, ComposedImage image) throws IOException {
for (Object object : image.getImages()) {
if (object instanceof ComposedImage) {
toAttribute(buffer, (ComposedImage)image);
} else if (object instanceof URL) {
buffer.append(Base64.encode(((URL)object).toString().getBytes(UTF8)));
}
buffer.append(DELIMITER);
}
}
项目:eclipse-avro
文件:XMLTypeFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public byte[] createBase64Binary(String literal)
{
if (literal == null) return null;
byte[] value = Base64.decode(collapseWhiteSpace(literal));
if (value == null)
{
throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");
}
return value;
}
项目:clickwatch
文件:XMLTypeFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public byte[] createBase64Binary(String literal)
{
if (literal == null) return null;
byte[] value = Base64.decode(collapseWhiteSpace(literal));
if (value == null)
{
throw new InvalidDatatypeValueException("Invalid base64Binary value: '" + literal + "'");
}
return value;
}
项目:clickwatch
文件:ResultsFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DataSet createDataSetFromString(EDataType eDataType, String initialValue) {
byte[] decoded = Base64.decode(initialValue);
DataSet dataSet;
try {
dataSet = (DataSet)new ObjectInputStream(new ByteArrayInputStream(decoded)).readObject();
} catch (Exception e) {
throw new IllegalArgumentException("is not a serialized DataSet");
}
return dataSet;
}
项目:clickwatch
文件:ResultsFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertDataSetToString(EDataType eDataType, Object instanceValue) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
new ObjectOutputStream(baos).writeObject(instanceValue);
} catch (IOException e) {
throw new IllegalArgumentException("cannot serialize data set");
}
String result = Base64.encode(baos.toByteArray());
return result;
}
项目:clickwatch
文件:CWDataBaseFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public SummaryStatistics createESummaryStatisticsFromString(EDataType eDataType, String initialValue) {
try {
byte[] bytes = Base64.decode(initialValue);
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
SummaryStatistics value = (SummaryStatistics)in.readObject();
in.close();
return value;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:clickwatch
文件:CWDataBaseFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertESummaryStatisticsToString(EDataType eDataType, Object instanceValue) {
try {
Serializable value = (Serializable)instanceValue;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos) ;
out.writeObject(value);
out.close();
return Base64.encode(bos.toByteArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:clickwatch
文件:CWDataBaseFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public HBaseRowMap createHBaseRowMapFromString(EDataType eDataType, String initialValue) {
try {
byte[] bytes = Base64.decode(initialValue);
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
HBaseRowMap value = (HBaseRowMap)in.readObject();
in.close();
return value;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:clickwatch
文件:CWDataBaseFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertHBaseRowMapToString(EDataType eDataType, Object instanceValue) {
try {
Serializable value = (Serializable)instanceValue;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos) ;
out.writeObject(value);
out.close();
return Base64.encode(bos.toByteArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:waqtsalat-eclipse-plugin
文件:WaqtSalatPreferenceStore.java
private static Object deserializeToObject(String base64String) throws IOException, ClassNotFoundException {
ByteArrayInputStream arrayInputStream = null;
EclipseObjectInputStream objectInputStream = null;
try {
byte[] data = Base64.decode(base64String);
arrayInputStream = new ByteArrayInputStream(data);
objectInputStream = new EclipseObjectInputStream(arrayInputStream);
return objectInputStream.readObject();
} finally {
closeQuietly(arrayInputStream, objectInputStream);
}
}
项目:eclipse-avro
文件:XMLTypeFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertBase64Binary(byte[] instanceValue)
{
return instanceValue == null ? null : Base64.encode(instanceValue);
}
项目:clickwatch
文件:XMLTypeFactoryImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertBase64Binary(byte[] instanceValue)
{
return instanceValue == null ? null : Base64.encode(instanceValue);
}