1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

[220379] [api] Provide a means for contributing custom BIDI encodings

This commit is contained in:
David McKnight 2008-03-07 17:41:55 +00:00
parent 96af532009
commit 7503d5e42b
4 changed files with 20 additions and 11 deletions

View file

@ -38,6 +38,7 @@
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Radoslav Gerganov (ProSyst) - [216195] [dstore] Saving empty file fails
* David McKnight (IBM) - [220379] [api] Provide a means for contributing custom BIDI encodings
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.files;
@ -542,7 +543,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
}
convBytes = codePageConverter.convertClientStringToRemoteBytes(tempStr, hostEncoding, this);
convBytes = codePageConverter.convertClientStringToRemoteBytes(remotePath, tempStr, hostEncoding, this);
// append subsequent segments
getDataStore().replaceAppendFile(remotePath, convBytes, convBytes.length, true, byteStreamHandlerId);
@ -766,7 +767,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this);
codePageConverter.convertFileFromRemoteEncoding(localFile, encoding, localEncoding, this);
codePageConverter.convertFileFromRemoteEncoding(remotePath, localFile, encoding, localEncoding, this);
}
@ -1008,7 +1009,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[i], this);
codePageConverter.convertFileFromRemoteEncoding(localFile, hostEncodings[i], localEncoding, this);
codePageConverter.convertFileFromRemoteEncoding(remoteElement.getName(), localFile, hostEncodings[i], localEncoding, this);
}
result = true;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2007,2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -12,6 +12,7 @@
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [209704] [api] Ability to override default encoding conversion needed.
* David McKnight (IBM) - [212229] using default code page converter that isn't null
* David McKnight (IBM) -[220379] [api] Provide a means for contributing custom BIDI encodings
********************************************************************************/
package org.eclipse.rse.services.files;
@ -75,6 +76,7 @@ public class CodePageConverterManager {
{
matchingCodePageConverter = getDefaultCodePageConverter();
}
return matchingCodePageConverter;
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2007,2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -10,6 +10,7 @@
*
* Contributors:
* David McKnight (IBM) -[209704] [api][dstore] Ability to override default encoding conversion needed.
* David McKnight (IBM) -[220379] [api] Provide a means for contributing custom BIDI encodings
********************************************************************************/
package org.eclipse.rse.services.files;
@ -20,8 +21,8 @@ import java.io.FileOutputStream;
public class DefaultFileServiceCodePageConverter implements
IFileServiceCodePageConverter {
public byte[] convertClientStringToRemoteBytes(String clientString,
public byte[] convertClientStringToRemoteBytes(String remotePath, String clientString,
String remoteEncoding, IFileService fs) {
try
{
@ -33,7 +34,7 @@ public class DefaultFileServiceCodePageConverter implements
return clientString.getBytes();
}
public void convertFileFromRemoteEncoding(File file, String remoteEncoding,
public void convertFileFromRemoteEncoding(String remotePath, File file, String remoteEncoding,
String localEncoding, IFileService fs) {
// read in the file
@ -72,4 +73,5 @@ public class DefaultFileServiceCodePageConverter implements
return 1000;
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2007,2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -10,6 +10,7 @@
*
* Contributors:
* David McKnight (IBM) -[209704] [api] Ability to override default encoding conversion needed.
* David McKnight (IBM) -[220379] [api] Provide a means for contributing custom BIDI encodings
********************************************************************************/
package org.eclipse.rse.services.files;
@ -27,22 +28,24 @@ public interface IFileServiceCodePageConverter {
/**
* Converts a client string to remote bytes, for use when uploading in binary mode.
* @param remotePath the path of the remote file
* @param clientString the client string to convert
* @param remoteEncoding The remote encoding for the desired server bytes
* @param fs The file service to apply conversion to.
* Can be used to determine implementation specific settings to the converter
* @return The bytes to upload to the server
*/
public byte [] convertClientStringToRemoteBytes(String clientString, String remoteEncoding, IFileService fs);
public byte [] convertClientStringToRemoteBytes(String remotePath, String clientString, String remoteEncoding, IFileService fs);
/**
* Converts the specified file (which was downloaded from the server in binary mode) from server encoding bytes, to local encoding
* @param remotePath the path of the remote file
* @param file The file to convert
* @param localEncoding The remote encoding of the file
* @param fs The file service to apply conversion to.
* Can be used to determine implementation specific settings to the converter
*/
public void convertFileFromRemoteEncoding(File file, String remoteEncoding, String localEncoding, IFileService fs);
public void convertFileFromRemoteEncoding(String remotePath, File file, String remoteEncoding, String localEncoding, IFileService fs);
/**
* Indicates whether or not the specified server encoding and subsystem implementation is supported by this code page converter
@ -59,4 +62,5 @@ public interface IFileServiceCodePageConverter {
* @return priority
*/
public int getPriority(String remoteEncoding, IFileService fs);
}