code stringlengths 31 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
public ItemIdentifier readItemIdentifier() throws IOException {
final int itemId = readInt();
if (itemId == 0) {
return null;
}
int damage = readInt();
NBTTagCompound tag = readNBTTagCompound();
return ItemIdentifier.get(Item.getItemById(itemId), damage, tag);
} | Base | 1 |
public void writeUTF(String s) throws IOException {
if (s == null) {
writeInt(-1);
} else {
writeByteArray(s.getBytes(UTF_8));
}
} | Base | 1 |
public boolean[] readBooleanArray() throws IOException {
final int bitCount = localBuffer.readInt();
if (bitCount == -1) {
return null;
}
byte[] data = readByteArray();
if (bitCount == 0) {
return new boolean[0];
} else if (data == null) {
throw new NullPointerException("Boolean's byte array is n... | Base | 1 |
private void unsetBuffer() {
if (localBuffer.hasMemoryAddress()) {
if (--reference < 1) {
BUFFER_WRAPPER_MAP.remove(localBuffer.memoryAddress());
}
}
localBuffer = null;
} | Base | 1 |
public byte[] readByteArray() throws IOException {
final int length = readInt();
if (length == -1) {
return null;
}
return readBytes(length);
} | Base | 1 |
public void writeItemIdentifierStack(ItemIdentifierStack stack) throws IOException {
if (stack == null) {
writeInt(-1);
} else {
writeInt(stack.getStackSize());
writeItemIdentifier(stack.getItem());
}
} | Base | 1 |
public ItemStack readItemStack() throws IOException {
final int itemId = readInt();
if (itemId == 0) {
return null;
}
int stackSize = readInt();
int damage = readInt();
ItemStack stack = new ItemStack(Item.getItemById(itemId), stackSize, damage);
stack.setTagCompound(readNBTTagCompound());
return s... | Base | 1 |
public <T> Set<T> readSet(IReadListObject<T> handler) throws IOException {
int size = readInt();
if (size == -1) {
return null;
}
Set<T> set = new HashSet<>(size);
for (int i = 0; i < size; i++) {
set.add(handler.readObject(this));
}
return set;
} | Base | 1 |
public void writeNBTTagCompound(NBTTagCompound tag) throws IOException {
if (tag == null) {
writeByte(0);
} else {
writeByte(1);
CompressedStreamTools.write(tag, new ByteBufOutputStream(localBuffer));
}
} | Base | 1 |
public void writeBytes(byte[] arr) throws IOException {
localBuffer.writeBytes(arr);
} | Base | 1 |
public NBTTagCompound readNBTTagCompound() throws IOException {
boolean isEmpty = (readByte() == 0);
if (isEmpty) {
return null;
}
return CompressedStreamTools.func_152456_a(new ByteBufInputStream(localBuffer), NBTSizeTracker.field_152451_a);
} | Base | 1 |
public <T extends Enum<T>> EnumSet<T> readEnumSet(Class<T> clazz) throws IOException {
EnumSet<T> types = EnumSet.noneOf(clazz);
byte[] arr = readByteArray();
if (arr != null) {
T[] parts = clazz.getEnumConstants();
for (T part : parts) {
if ((arr[part.ordinal() / 8] & (1 << (part.ordinal() % 8))) != 0... | Base | 1 |
public ByteBuf readByteBuf() throws IOException {
byte[] arr = readByteArray();
if (arr == null) {
throw new NullPointerException("Buffer may not be null, but read null");
} else {
return wrappedBuffer(arr);
}
} | Base | 1 |
public void writeByteArray(byte[] arr) throws IOException {
if (arr == null) {
writeInt(-1);
} else {
writeInt(arr.length);
writeBytes(arr);
}
} | Base | 1 |
public ItemIdentifierStack readItemIdentifierStack() throws IOException {
int stacksize = readInt();
if (stacksize == -1) {
return null;
}
ItemIdentifier item = readItemIdentifier();
return new ItemIdentifierStack(item, stacksize);
} | Base | 1 |
public void writeItemStack(ItemStack itemstack) throws IOException {
if (itemstack == null) {
writeInt(0);
} else {
writeInt(Item.getIdFromItem(itemstack.getItem()));
writeInt(itemstack.stackSize);
writeInt(itemstack.getItemDamage());
writeNBTTagCompound(itemstack.getTagCompound());
}
} | Base | 1 |
public void writeResource(IResource res) throws IOException {
ResourceNetwork.writeResource(this, res);
} | Base | 1 |
public <T extends Enum<T>> void writeEnumSet(EnumSet<T> types, Class<T> clazz) throws IOException {
T[] parts = clazz.getEnumConstants();
final int length = parts.length / 8 + (parts.length % 8 == 0 ? 0 : 1);
byte[] set = new byte[length];
for (T part : parts) {
if (types.contains(part)) {
byte i = (by... | Base | 1 |
public void writeBooleanArray(boolean[] arr) throws IOException {
if (arr == null) {
writeInt(-1);
} else if (arr.length == 0) {
writeInt(0);
writeByteArray(null);
} else {
BitSet bits = new BitSet(arr.length);
for (int i = 0; i < arr.length; i++) {
bits.set(i, arr[i]);
}
writeInt(arr.le... | Base | 1 |
public byte[] readBytes(int length) throws IOException {
byte[] arr = new byte[length];
localBuffer.readBytes(arr, 0, length);
return arr;
} | Base | 1 |
public void writeItemIdentifier(ItemIdentifier item) throws IOException {
if (item == null) {
writeInt(0);
} else {
writeInt(Item.getIdFromItem(item.item));
writeInt(item.itemDamage);
writeNBTTagCompound(item.tag);
}
} | Base | 1 |
public LinkedLogisticsOrderList readLinkedLogisticsOrderList() throws IOException {
LinkedLogisticsOrderList list = new LinkedLogisticsOrderList();
List<IOrderInfoProvider> orderInfoProviders = readArrayList(LPDataInput::readOrderInfo);
if (orderInfoProviders == null) {
throw new IOException("Expected order ... | Base | 1 |
public IResource readResource() throws IOException {
return ResourceNetwork.readResource(this);
} | Base | 1 |
public void writeBitSet(BitSet bits) throws IOException {
if (bits == null) {
throw new NullPointerException("BitSet may not be null");
}
writeByteArray(bits.toByteArray());
} | Base | 1 |
public static byte[] collectData(LPDataOutputConsumer dataOutputConsumer) throws IOException {
ByteBuf dataBuffer = buffer();
LPDataIOWrapper lpData = getInstance(dataBuffer);
dataOutputConsumer.accept(lpData);
lpData.unsetBuffer();
byte[] data = new byte[dataBuffer.readableBytes()];
dataBuffer.getBytes... | Base | 1 |
public void writeOrderInfo(IOrderInfoProvider order) throws IOException {
writeItemIdentifierStack(order.getAsDisplayItem());
writeInt(order.getRouterId());
writeBoolean(order.isFinished());
writeBoolean(order.isInProgress());
writeEnum(order.getType());
writeCollection(order.getProgresses(), LPDataOutput:... | Base | 1 |
public <T> void writeCollection(Collection<T> collection, IWriteListObject<T> handler) throws IOException {
if (collection == null) {
writeInt(-1);
} else {
writeInt(collection.size());
for (T obj : collection) {
handler.writeObject(this, obj);
}
}
} | Base | 1 |
public static void provideData(ByteBuf dataBuffer, LPDataInputConsumer dataInputConsumer) throws IOException {
LPDataIOWrapper lpData = getInstance(dataBuffer);
dataInputConsumer.accept(lpData);
lpData.unsetBuffer();
} | Base | 1 |
public BitSet readBitSet() throws IOException {
byte[] arr = readByteArray();
if (arr == null) {
return new BitSet();
} else {
return BitSet.valueOf(arr);
}
} | Base | 1 |
public static void provideData(byte[] data, LPDataInputConsumer dataInputConsumer) throws IOException {
ByteBuf dataBuffer = wrappedBuffer(data);
LPDataIOWrapper lpData = getInstance(dataBuffer);
dataInputConsumer.accept(lpData);
lpData.unsetBuffer();
dataBuffer.release();
} | Base | 1 |
public void writeLinkedLogisticsOrderList(LinkedLogisticsOrderList orderList) throws IOException {
writeCollection(orderList, LPDataOutput::writeOrderInfo);
writeCollection(orderList.getSubOrders(), LPDataOutput::writeLinkedLogisticsOrderList);
} | Base | 1 |
public void testNullArrayList() throws Exception {
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(null, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
assertEquals(null, input.readArrayList(LPDataInput::readUTF));
assertEquals(BUFFER_EMPTY_MSG, 0, ((LPDat... | Base | 1 |
public void testArrayList() throws Exception {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("drölf");
arrayList.add("text");
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(arrayList, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
asse... | Base | 1 |
public void testLinkedList() throws Exception {
LinkedList<String> linkedList = new LinkedList<>();
linkedList.add("drölf");
linkedList.add("text");
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(linkedList, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
... | Base | 1 |
public void testNullSet() throws Exception {
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(null, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
assertEquals(null, input.readSet(LPDataInput::readUTF));
assertEquals(BUFFER_EMPTY_MSG, 0, ((LPDataIOWrapper) ... | Base | 1 |
public void testSet() throws Exception {
HashSet<String> set = new HashSet<>();
set.add("drölf");
set.add("text");
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(set, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
assertEquals(set, input.readSet(LPData... | Base | 1 |
public void testNullLinkedList() throws Exception {
byte[] data = LPDataIOWrapper.collectData(output -> output.writeCollection(null, LPDataOutput::writeUTF));
LPDataIOWrapper.provideData(data, input -> {
assertEquals(null, input.readLinkedList(LPDataInput::readUTF));
assertEquals(BUFFER_EMPTY_MSG, 0, ((LPD... | Base | 1 |
public static Service getService(Map environment)
{
Service service = null;
InitialContext context = null;
EngineConfiguration configProvider =
(EngineConfiguration)environment.get(EngineConfiguration.PROPERTY_NAME);
if (configProvider == null)
configPro... | Base | 1 |
private DDFFileParser(DDFFileValidator ddfValidator, DDFFileValidatorFactory ddfFileValidatorFactory) {
factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
this.ddfValidator = ddfValidator;
this.ddfValidatorFactory = ddfFileValidatorFactory;
} | Base | 1 |
protected Schema getEmbeddedLwM2mSchema() throws SAXException {
InputStream inputStream = DDFFileValidator.class.getResourceAsStream(schema);
Source source = new StreamSource(inputStream);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
re... | Base | 1 |
public void load(Reader r) {
Document document = null;
try {
DocumentBuilder parser = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
// parser.setProcessNamespace(true);
document = parser.parse(new InputSource(r));
//Strip out any comments first
Node root = document.getFirstChild... | Base | 1 |
public void parseInputStream(InputStream is, boolean expandURLs) {
documentBuilderFactory.setNamespaceAware(true);
documentBuilderFactory.setIgnoringComments(true);
reset();
try {
DocumentBuilder parser = documentBuilderFactory
.newDocumentBuilder();
parser.setErrorHandler(new ParseErrorHandler())... | Base | 1 |
public void gotoMarker(IMarker marker) {
// do nothing
} | Base | 1 |
public void read(InputStream is) throws IOException {
try {
parser = new WelcomeParser();
} catch (ParserConfigurationException | SAXException e) {
throw (IOException) (new IOException().initCause(e));
}
parser.parse(is);
} | Base | 1 |
public WelcomeParser() throws ParserConfigurationException, SAXException,
FactoryConfigurationError {
super();
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setFeature("http://xml.org/sax/features/namespaces", true); //$NON-NLS-1$
parser = factory.newSAXParser();
parser.getXMLReader(... | Base | 1 |
private static String getAttributeNewValue(Object attributeOldValue) {
StringBuilder strNewValue = new StringBuilder(FILE_STRING);
if (attributeOldValue instanceof String && ((String) attributeOldValue).length() != 0) {
String strOldValue = (String) attributeOldValue;
boolean exists = Arrays.asList(strOldVal... | Base | 1 |
public static XMLMemento createWriteRoot(String type) throws DOMException {
Document document;
try {
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element element = document.createElement(type);
document.appendChild(element);
return new XMLMemento(document, element... | Base | 1 |
private void close(Closeable closeable) {
try {
closeable.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
} | Base | 1 |
private void transformDocument(Writer writer) {
try {
DOMSource source = new DOMSource(this.document);
TransformerFactory.newInstance().newTransformer().transform(source, new StreamResult(writer));
} catch (TransformerException e) {
throw new IllegalStateException(e);
} finally {
close(writer);
}
... | Base | 1 |
private Document getDom(Reader reader) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(new InputSource(reader));
} catch (ParserConfigurationException | IOException | SAXException e) {
throw new I... | Base | 1 |
private static DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
return factory.newDocumentBuilder();
} | Base | 1 |
public static Document createDocument(String name) throws ParserConfigurationException {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
doc.appendChild(doc.createElement(name));
return doc;
} | Base | 1 |
static private String docToString(Document doc) throws TransformerException {
final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
final StringWriter writer = new... | Base | 1 |
static private List<String> getOutputDirectories(String installLocation) {
List<String> ret = outputDirectories.get(installLocation);
if (ret == null) {
ret = new ArrayList<>();
outputDirectories.put(installLocation, ret);
try {
final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuil... | Base | 1 |
public static TestRunSession importTestRunSession(File file) throws CoreException {
try {
SAXParserFactory parserFactory= SAXParserFactory.newInstance();
// parserFactory.setValidating(true); // TODO: add DTD and debug flag
SAXParser parser= parserFactory.newSAXParser();
TestRunHandler handler= new TestRu... | Base | 1 |
public static void exportTestRunSession(TestRunSession testRunSession, OutputStream out)
throws TransformerFactoryConfigurationError, TransformerException {
Transformer transformer= TransformerFactory.newInstance().newTransformer();
InputSource inputSource= new InputSource();
SAXSource source= new SAXSource(... | Base | 1 |
public static void importIntoTestRunSession(File swapFile, TestRunSession testRunSession) throws CoreException {
try {
SAXParserFactory parserFactory= SAXParserFactory.newInstance();
// parserFactory.setValidating(true); // TODO: add DTD and debug flag
SAXParser parser= parserFactory.newSAXParser();
TestR... | Base | 1 |
public static TestRunSession importTestRunSession(String url, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(ModelMessages.JUnitModel_importing_from_url, IProgressMonitor.UNKNOWN);
final String trimmedUrl= url.trim().replaceAll("\r\n?|\n", ""); //$NON-NLS-1$ //... | Base | 1 |
private static Element readXML(IPath xmlFilePath) throws Exception {
try (InputStream in = new FileInputStream(xmlFilePath.toFile())) {
DocumentBuilder parser= DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
Element root= parser.parse(new InputSource(... | Base | 1 |
public void saveToStream(OutputStream stream) throws CoreException {
try {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
DocumentBuilder builder= factory.newDocumentBuilder();
Document document= builder.newDocument();
Node root= document.createElement("templates"); //$NON-NLS-1$
... | Base | 1 |
public void addFromStream(InputStream stream, boolean allowDuplicates) throws CoreException {
try {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
DocumentBuilder parser= factory.newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
Document document= parser.parse(new... | Base | 1 |
private void save(OutputStream stream) throws CoreException {
try {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
DocumentBuilder builder= factory.newDocumentBuilder();
Document document= builder.newDocument();
Element rootElement = document.createElement(fRootNodeName);
docum... | Base | 1 |
private void load(InputSource inputSource) throws CoreException {
Element root;
try {
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
root = parser.parse(inputSource).getDocumentElement();
} catch (SAXException | ParserCon... | Base | 1 |
public JarPackageData readXML(JarPackageData jarPackage) throws IOException, SAXException {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder parser= null;
try {
parser= factory.newDocumentBuilder();
} catch (ParserConfigurationExcept... | Base | 1 |
public void writeXML(JarPackageData jarPackage) throws IOException {
Assert.isNotNull(jarPackage);
DocumentBuilder docBuilder= null;
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
factory.setValidating(false);
try {
docBuilder= factory.newDocumentBuilder();
} catch (ParserConfi... | Base | 1 |
public Element readXML() throws IOException, SAXException {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder parser= null;
try {
parser= factory.newDocumentBuilder();
} catch (ParserConfigurationException ex) {
throw new IOException(ex... | Base | 1 |
public static void writeDocument(Element javadocElement, String encoding, OutputStream outputStream) throws TransformerException {
// Write the document to the stream
Transformer transformer=TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$... | Base | 1 |
public Element createXML(JavadocOptionsManager store) throws ParserConfigurationException {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder docBuilder= factory.newDocumentBuilder();
Document document= docBuilder.newDocument();
// Create the... | Base | 1 |
public static void writeProfilesToStream(Collection<Profile> profiles, OutputStream stream, String encoding, IProfileVersioner profileVersioner) throws CoreException {
try {
final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
final DocumentBuilder builder= factory.newDocumentBuilder();... | Base | 1 |
public static List<Profile> readProfilesFromStream(InputSource inputSource) throws CoreException {
final ProfileDefaultHandler handler= new ProfileDefaultHandler();
try {
final SAXParserFactory factory= SAXParserFactory.newInstance();
final SAXParser parser= factory.newSAXParser();
parser.parse(inputS... | Base | 1 |
public void store(ContentAssistHistory history, StreamResult result) throws CoreException {
try {
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
DocumentBuilder builder= factory.newDocumentBuilder();
Document document= builder.newDocument();
Element rootElement = document.cr... | Base | 1 |
public ContentAssistHistory load(InputSource source) throws CoreException {
Element root;
try {
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
root = parser.parse(source).getDocumentElement();
} catch (SAXException... | Base | 1 |
public RefactoringSessionDescriptor readSession(final InputSource source) throws CoreException {
fSessionFound= false;
try {
source.setSystemId("/"); //$NON-NLS-1$
createParser(SAXParserFactory.newInstance()).parse(source, this);
if (!fSessionFound)
throw new CoreException(new Status(IStatus.ERROR, Re... | Base | 1 |
public void beginSession(final String comment, final String version) throws CoreException {
if (fDocument == null) {
try {
fDocument= DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
fSession= fDocument.createElement(IRefactoringSerializationConstants.ELEMENT_SESSION);
fSession... | Base | 1 |
private Document getCachedDocument(final IPath path, final InputStream input) throws SAXException, IOException, ParserConfigurationException {
if (path.equals(fCachedPath) && fCachedDocument != null)
return fCachedDocument;
DocumentBuilder parser= DocumentBuilderFactory.newInstance().newDocumentBuilder();
par... | Base | 1 |
public static Document convertModel(Iterable<? extends javax.lang.model.element.Element> declarations) throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document model = factory.newDocumentBuilder().newDocument();
org.w3c.dom.Element modelNode = model.cr... | Base | 1 |
public static String xmlToString(Document model) {
StringWriter s = new StringWriter();
DOMSource domSource = new DOMSource(model);
StreamResult streamResult = new StreamResult(s);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer;
try {
serializer = tf.newTransformer();
... | Base | 1 |
private boolean checkModel(List<TypeElement> rootElements, String expected, String name) throws Exception {
Document actualModel = XMLConverter.convertModel(rootElements);
InputSource source = new InputSource(new StringReader(expected));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(... | Base | 1 |
public static String[] buildTables(
final double unicodeValue,
boolean usePredefinedRange,
Environment env,
String unicodeDataFileName) throws IOException {
List<String> result = new ArrayList<>();
SAXParser saxParser = null;
try {
saxParser = SAXParserFactory.newInstance().newSAXParser();
} ca... | Base | 1 |
public static Map decodeCodeFormatterOptions(String fileName, String profileName) {
try {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
final DecodeCodeFormatterPreferences preferences = new DecodeCodeFormatterPreferences(profileName);
saxParser.parse(new File(fileName), preferences);... | Base | 1 |
public static Map decodeCodeFormatterOptions(String zipFileName, String zipEntryName, String profileName) {
ZipFile zipFile = null;
BufferedInputStream inputStream = null;
try {
zipFile = new ZipFile(zipFileName);
ZipEntry zipEntry = zipFile.getEntry(zipEntryName);
if (zipEntry == null) {
return nul... | Base | 1 |
public IClasspathEntry decodeClasspathEntry(String encodedEntry) {
try {
if (encodedEntry == null) return null;
StringReader reader = new StringReader(encodedEntry);
Element node;
try {
DocumentBuilder parser =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
node = parser.parse(... | Base | 1 |
Document getDocument(String xmlPath) {
try (InputStream is = createInputStream(xmlPath)) {
if (is != null) {
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(is));
}
} catch (Exception e) {
//ignored
}
return null;
} | Base | 1 |
public void t1canSetConfigParm() throws Exception {
IProject project = checkProject();
assertNotNull(project);
IPath path = project.getLocation();
path = path.append(".autotools");
File f = new File(path.toOSString());
assertTrue(f.exists());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstan... | Base | 1 |
protected static Document getAMDoc(String amDocVer) {
Document amDocument = null;
if (amHoverDocs == null) {
amHoverDocs = new HashMap<>();
}
amDocument = amHoverDocs.get(amDocVer);
if (amDocument == null) {
Document doc = null;
try {
// see comment in initialize()
try {
InputStream doc... | Base | 1 |
protected static Document getACDoc(String acDocVer) {
Document acDocument = null;
if (acHoverDocs == null) {
acHoverDocs = new HashMap<>();
}
acDocument = acHoverDocs.get(acDocVer);
if (acDocument == null) {
Document doc = null;
try {
// see comment in initialize()
try {
InputStream doc... | Base | 1 |
protected ICStorageElement translateInputStreamToDocument(InputStream input) {
try {
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input);
return XmlStorageUtil.createCStorageTree(document);
} catch (Exception e) {
MakeCorePlugin.log(e);
}
return null;
} | Base | 1 |
public void saveDiscoveredScannerInfoToState(IProject project, InfoContext context,
IDiscoveredScannerInfoSerializable serializable) throws CoreException {
Document document = getDocument(project);
// Create document
try {
saveDiscoveredScannerInfo(context, serializable, document);
// Transform the doc... | Base | 1 |
private Document getDocument(IProject project) throws CoreException {
// Get the document
Reference<Document> ref = fDocumentCache.get(project);
Document document = ref != null ? ref.get() : null;
if (document == null) {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBui... | Base | 1 |
public static boolean manages(IResource resource) {
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(resource.getProject(), false);
if (des == null) {
return false;
}
ICConfigurationDescription cfgDes = des.getActiveConfiguration();
IConfiguration cfg = ManagedBuildManager.getConfi... | Base | 1 |
public static void main(String[] args) {
Test test = new Test();
try {
XMLDumper dumper = new XMLDumper(test);
Document document = dumper.getDocument();
StringWriter writer = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.transform(new D... | Base | 1 |
public XMLDumper(Object obj) throws ParserConfigurationException {
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
document.appendChild(createObject(obj));
} | Base | 1 |
private Transformer createSerializer() throws CoreException {
try {
return TransformerFactory.newInstance().newTransformer();
} catch (TransformerConfigurationException e) {
throw new CoreException(Util.createStatus(e));
} catch (TransformerFactoryConfigurationError e) {
throw new CoreException(Util.cre... | Base | 1 |
public void storeMappings(WorkspaceLanguageConfiguration config) throws CoreException {
try {
// Encode mappings as XML and serialize as a String.
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element rootElement = doc.createElement(WORKSPACE_MAPPINGS);
doc.appen... | Base | 1 |
public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
String encodedMappings = node.get(CCorePreferenceConstan... | Base | 1 |
private synchronized void initExtensionPoints() {
if (storageTypeMap != null)
return;
Map<String, List<CProjectDescriptionStorageTypeProxy>> m = new HashMap<>();
IExtensionPoint extpoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
CPROJ_DESC_STORAGE_EXT_ID);
for (IExtensio... | Base | 1 |
public Element createXmlElementCopy(InternalXmlStorageElement el) throws CoreException {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
Element newXmlEl = null;
synchronized (doc) {
synchronized (el.fLock) {
if (el... | Base | 1 |
private ByteArrayOutputStream write(ICStorageElement element) throws CoreException {
Document doc = ((InternalXmlStorageElement) element).fElement.getOwnerDocument();
XmlUtil.prettyFormat(doc);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
Transformer transformer = TransformerFactory.ne... | Base | 1 |
private ICStorageElement readOldCDTProjectFile(IProject project) throws CoreException {
ICStorageElement storage = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = null;
InputStream stream = getSharedProperty(project, OLD_CDTPROJECT_FILE_NAME)... | Base | 1 |
protected Element createXmlElementCopy() throws CoreException {
try {
synchronized (fLock) {
Element newXmlEl = null;
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
synchronized (doc) {
if (fElement.getParentNode().g... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.